WebStorm 找不到 npm
WebStorm cannot find npm
我最近更新到 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 指向符号链接文件
但是从以下 package.json
执行 npm run test
通过 IDE 时出现以下错误:
"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并从终端启动一次似乎已经解决了问题。现在我可以使用 Alfred 或 Spotlight 启动 webstorm 并且问题不会再次弹出。
我最近更新到 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 指向符号链接文件
但是从以下 package.json
执行 npm run test
通过 IDE 时出现以下错误:
"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并从终端启动一次似乎已经解决了问题。现在我可以使用 Alfred 或 Spotlight 启动 webstorm 并且问题不会再次弹出。