Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WebStorm - error: Please specify npm package

Tags:

Webstorm throws an error when trying to run a command specified in package.json:

"devDependencies": {},
      "scripts": {
        "dev": "./node_modules/.bin/webpack-dev-server --content-base src --inline --hot",
        "test": "echo \"Error: no test specified\" && exit 1"
      },

I've used this script with Webstorm on other computers (Linux/Windows). On this one (Linux), it does not seem to work out of a sudden. It used to be fine. I've just upgraded Webstorm. From CLI, the 'dev'command works fine, it's something to do with Webstorm configuration. The In Settings => Languages & Frameworks => NOde.js and NPM the node interpreter is specified as /usr/bin/node which is the correct path. I also clicked to Enable Node.js Core library. Still in the NPM window on Webstorm, when I want to run the 'dev' script, it throws the above mentioned error. The project is a react project, if that matters.

In the past, it ran fine. Please advise.

Edit: Added a screenshot - Defaults

enter image description here

dev => Edit 'dev' settings:

enter image description here

like image 430
Wasteland Avatar asked Mar 25 '16 16:03

Wasteland


People also ask

How npm install all dependencies?

NPM installs devDependencies within the package. json file. The 'npm install' command should add all the dependencies and devDependencies automatically during installation. If you need to add specific devDependencies to your project, you can use this command- 'npm install --save-dev'.


1 Answers

Ran into the same issue after upgrading from 11.0.3 to 2016.1. Not sure if some configuration was wrongly copied or if they added a new field to specify the npm package.

Go to

Run > Edit Configurations > Defaults > npm

Browse to select a Node interpreter, using the [...] button.

You should find the Npm package field, fill it with YOUR_PATH_TO_NODE/lib/node_modules/npm.

If it does not work right away, restart WebStorm so that it is taken into account.

Run/Debug Configurations > NPM screenshot

like image 99
Anthony Drogon Avatar answered Sep 19 '22 18:09

Anthony Drogon