WebStorm - 错误:请指定 npm 包 [英] WebStorm - error: Please specify npm package

查看:117
本文介绍了WebStorm - 错误:请指定 npm 包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Webstorm 在尝试运行 package.json 中指定的命令时抛出错误:

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"
      },

我已经在其他计算机(Linux/Windows)上将此脚本与 Webstorm 一起使用.在这个 (Linux) 上,它似乎不是突然出现的.它曾经很好.我刚刚升级了Webstorm.在 CLI 中,'dev'命令工作正常,这与 Webstorm 配置有关.这在设置 => 语言 &Frameworks => NOde.js 和 NPM 节点解释器被指定为/usr/bin/node 这是正确的路径.我还单击了启用 Node.js 核心库.仍然在 Webstorm 的 NPM 窗口中,当我想运行开发"脚本时,它会抛出上述错误.该项目是一个 React 项目,如果这很重要的话.

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.

添加了屏幕截图 - 默认值

Added a screenshot - Defaults

dev => 编辑开发"设置:

dev => Edit 'dev' settings:

推荐答案

从 11.0.3 升级到 2016.1 后遇到同样的问题.不确定某些配置是否被错误地复制,或者他们是否添加了一个新字段来指定 npm 包.

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.

前往

运行 > 编辑配置 > 默认值 > npm

Run > Edit Configurations > Defaults > npm

使用 [...] 按钮浏览以选择一个节点解释器.

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

您应该找到 Npm 包 字段,用 YOUR_PATH_TO_NODE/lib/node_modules/npm 填充它.

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

如果它没有立即起作用,请重新启动 WebStorm 以便将其考虑在内.

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

这篇关于WebStorm - 错误:请指定 npm 包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆