npm - 系统找不到指定的路径 [英] npm - The system cannot find the path specified
问题描述
我已经安装了 nodejs
.当我尝试通过 power shell 或 cmd 使用 npm
时,它返回
I have installed nodejs
. When I try and use npm
via power shell or cmd it returns
系统找不到指定的路径.
The system cannot find the path specified.
如果我运行 node -v
一切正常.我也可以通过 nodejs
控制台使用 npm
就好了.我多次尝试卸载并重新安装 nodejs
,但没有帮助.
If I run node -v
everything works fine. I can use npm
via the nodejs
console just fine as well. I've tried uninstalling and reinstalling nodejs
multiple times and it didn't help.
对导致这种情况的原因有什么想法吗?
Any ideas on what is causing this?
推荐答案
对于遇到此问题的任何人,尝试调试此错误以了解为什么 npm run
在 Windows 上不起作用node_modules/.bin/中的东西,例如 gulp,这与 npm 为孩子使用 cmd.exe 而不是 bash 的事实有关.
For anyone who runs into this trying to debug this error on why npm run <script>
doesn't work on Windows for things in node_modules/.bin/ such as gulp, it relates to the fact that npm is using cmd.exe instead of bash for the child.
您可以使用 npm config set script-shell bash
这篇关于npm - 系统找不到指定的路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!