WebStorm - error: Please specify npm package

后端 未结 12 2286
忘掉有多难
忘掉有多难 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:21

    On Windows I was unable to solve the problem using the Npm package configuration setting using a custom npm installation.

    Installing a standard npm via the node.js solved the problem in WebStorm without having to set the Npm package configuration.

    0 讨论(0)
  • 2020-12-29 07:22

    On Xubuntu and Linux Mint, use /usr/bin/lib/nodejs/npm.

    0 讨论(0)
  • 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
    0 讨论(0)
  • 2020-12-29 07:28

    just want to add some reference. in my machine it's in /usr/share/npm so just fill that field with that.

    0 讨论(0)
  • 2020-12-29 07:31

    In my case ubuntu 18.04+PHPSTORM Helps this:

    apt-get remove nodejs
    apt-get remove npm
    

    Using Ubuntu

    curl -sL https://deb.nodesource.com/setup_11.x | sudo -E bash -
    sudo apt-get install -y nodejs
    
    0 讨论(0)
  • 2020-12-29 07:34

    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.

    0 讨论(0)
提交回复
热议问题