简体   繁体   中英

Unable to create React.js project in WebStorm

I am going to create a React.js web application in WebStorm. I have installed create-react-app in /usr/local/bin and Node.js interpreter. I use Debian sid Linux distribution. When I try create project in WebStorm I receive this error:

/usr/bin/node /usr/local/bin/index.js .
module.js:538
    throw err;
    ^

Error: Cannot find module '/usr/local/bin/index.js'
    at Function.Module._resolveFilename (module.js:536:15)
    at Function.Module._load (module.js:466:25)
    at Function.Module.runMain (module.js:676:10)
    at startup (bootstrap_node.js:187:16)
    at bootstrap_node.js:608:3
Done

I hope for help.

Try installing both node and create-reat-app globally by using -g flag in npm and make sure both are available system wide. To make node-interpreter available globally try setting default in nvm or try installing nodejs-legacy.

Anyways Web storm provides coding assistance depending on the file extension. Such as if it is a .jsx file then auto completion helps you in writing react specific syntax and enhanced ES syntax.

Also even after creating the project via Webstorm you have to install dependencies though npm install.

So my suggestion is instead of getting stuck just create a project using only create-react-app from the console by typing create-react-app and then everything will be set for you. Test the set up by going inside the project folder and running npm start you could see basic react app open in your browser.

For further coding you can open your project folder inside web storm and continue with your project

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM