Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

create-react-app in WebStorm

I am attempting to use the npm package "create-react-app" to get started on a react project using WebStorm.

I have run npm install -g create-react-app to install the package globally, and can use the package perfectly fine with from the command line (i.e. create-react-app <proj name>).

However when creating a project in WebStorm and using the path to the global "create-react-app" package (found using npm list -g), I encounter this error:

/usr/bin/node /usr/local/lib/node_modules/create-react-app/index.js .
/usr/local/lib/node_modules/create-react-app/createReactApp.js:589

    .filter(file => !validFiles.includes(file));
                            ^

TypeError: validFiles.includes is not a function
    at /usr/local/lib/node_modules/create-react-
app/createReactApp.js:589:33
    at Array.filter (native)
    at isSafeToCreateProjectIn (/usr/local/lib/node_modules/create-
react-app/createReactApp.js:589:6)
    at createApp (/usr/local/lib/node_modules/create-react-
app/createReactApp.js:147:8)
    at Object.<anonymous> (/usr/local/lib/node_modules/create-react-
app/createReactApp.js:134:1)
    at Module._compile (module.js:410:26)
    at Object.Module._extensions..js (module.js:417:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Module.require (module.js:354:17)
Done

Have I gone wrong at some point?

like image 634
SykeJ Avatar asked Oct 29 '22 02:10

SykeJ


1 Answers

It turns out I had node version 4, and create-react-app requires version >= 6 - although this warning was not displayed via the WebStorm "Run" panel.

Thus I fixed this issue by updating to node v6.11.3, using nvm.

like image 73
SykeJ Avatar answered Nov 09 '22 06:11

SykeJ