【发布时间】:2020-12-10 23:46:38
【问题描述】:
我最近更新到 WebStorm 2020.3,我收到以下错误:Cannot resolve 'npm' package manager,升级前不是这种情况。
我已验证我的系统上安装了 npm:
9:12am /Users/paymahn/sagebackend notify.of.payments ⬆ ⬇ ✭ ✱ ◼
❯❯❯ which npm
/usr/local/bin/npm
9:12am /Users/paymahn/sagebackend notify.of.payments ⬆ ⬇ ✭ ✱ ◼
❯❯❯ npm -v
7.0.10
我也尝试手动将 WebStorm 指向 /usr/local/bin/npm,但这似乎没有帮助,因为 /usr/local/bin/npm 是一个符号链接。我尝试将 WebStorm 指向符号链接文件
但在通过IDE从以下package.json执行npm run test时出现以下错误:
"scripts": {
"lint": "./node_modules/.bin/eslint --max-warnings=0 .",
"serve": "firebase serve --only functions",
"shell": "firebase experimental:functions:shell",
"start": "npm run shell",
"deploy": "firebase deploy --only functions",
"logs": "firebase functions:log",
"prettier": "npx prettier --write .",
"test": "mocha --reporter spec"
},
/usr/local/Cellar/node/15.2.1/bin/node /usr/local/lib/node_modules/npm/bin/npm-cli.js test --scripts-prepend-node-path=auto
> test
> mocha --reporter spec
env: node: No such file or directory
npm ERR! code 127
npm ERR! path /Users/paymahn/sagebackend/functions
npm ERR! command failed
npm ERR! command sh -c mocha --reporter spec
但是,我可以从命令行成功运行测试:
9:19am /Users/paymahn/sagebackend/functions ✘ 1 notify.of.payments ⬆ ⬇ ✭ ✱ ◼
❮❮❮ npm run test
> test
> mocha --reporter spec
0 passing (1ms)
如何从 WebStorm 成功执行 npm 命令?
【问题讨论】:
-
哦,看来从终端启动 webstorm 已经修复了:intellij-support.jetbrains.com/hc/en-us/community/posts/… 我想知道为什么会这样