Error creating react-app in Webstorm

Hello. I am seeing the following when I try to create a new react app in Webstorm. 

/home/andrew/.nvm/versions/node/v8.9.1/bin/node /home/andrew/.nvm/versions/node/v8.9.1/lib/node_modules/create-react-app/index.js .

Creating a new React app in /home/andrew/Workspace/Projects/App/react-app.

Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...

/bin/sh: 1: npm: not found
events.js:183
throw er; // Unhandled 'error' event
^

Error: spawn npm ENOENT
at _errnoException (util.js:1024:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:190:19)
at onErrorNT (internal/child_process.js:372:16)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
at Function.Module.runMain (module.js:678:11)
at startup (bootstrap_node.js:187:16)
at bootstrap_node.js:608:3
Done

I am creating the react project using the following:

Any ideas on what is going wrong? Thanks!

0

Please try starting WebStorm from terminal using bin/webstorm.sh - does the problem persist?

0

Hello,

First, thank you for this great application!

Sorry for possible post necromancy, but I have a similar issue (Ubuntu 18.04, last nodejs and npm from nvm, CLion installed from the Toolbox, last version) :

- it works fine from the terminal;

- otherwise impossible to create a React application

What I have already done to try to solve the issue:

- installing the create-react-app globally,

- terminal settings as below:

Thanks you in advance for your support,

Best regards

0

Looks like npm is not on your $PATH.. Try starting CLion from terminal - does the issue persist?

0

Hello,

The issue doesn't persiste when started from terminal

0

so it's indeed a $PATH issue...

When being launched from desktop/System menu, WebStorm only sees environment variables configured in ~/.profile (login shell), but not in interactive shell configuration files (like ~/.bashhrc). Possible workarounds:

  • Workaround 1: make required variables available in a login shell (i.e. for bash, move them from .bashrc to .bash_profile).
  • Workaround 2: run IDE from a terminal, via bin/webstorm.sh
  • Workaround 3: edit your Webstorm launcher and set command to /bin/bash -l -i -c "/path/to/webstorm.sh"

see also https://youtrack.jetbrains.com/issue/IDEABKL-7589

0

Thank you for your answers.

Best regards

1

请先登录再写评论。