WebStorm - error: Please specify npm package

后端 未结 12 2439
忘掉有多难
忘掉有多难 2020-12-29 06:53

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

\"devDependencies\": {},
      \"scripts\": {
        \"dev\": \"./node_modu         


        
12条回答
  •  轮回少年
    2020-12-29 07:26

    If you installed Node.JS from the official website (not from the apt repository), you probably put the installation folder somewhere at /opt/node-v10.13.0-linux-x64 (depending on your preferences).

    If so, you should modify your WebStorm settings as follows:

    1. Ctrl+Alt+S to bring up Settings window
    2. Go to "Languages and Frameworks" tab and select "Node.js & NPM"
    3. On the right side,
      • for field "Node interpreter" click on "..." and in the opened window click on "+" button and "Add local". In the drop-down list select /opt/node-v10.13.0-linux-x64/bin/node and click OK.
      • now, for a "Package manager" field click "..." next to it, and just select the folder /opt/node-v10.13.0-linux-x64/bin and click OK. As it was pointed out already, for npm WebStorm doesn't expect you to provide the full path to npm binary, just to the folder where this binary is.
    4. Click Apply.
    5. Now you should be all set to go

提交回复
热议问题