Windows,VSC,Running npm start得到了这个
npm WARN生命周期用于脚本的节点二进制文件是C:\ Program Files \nodejs \node.exe,但是npm使用的是C:\ somewhere\AppData\Roaming \npm \node_modules \node\bin \node.exe本身.使用该
--scripts-prepend-node-path选项可以包含执行的节点二进制文件npm的路径.
我理解这意味着我的本地版本是PATH变量(C:\ Program Files ...)中的差异.如何继续告诉它使用--scripts-prepend-node-path?
我通过替换PATH变量中的C:\Program Files\nodejswith C:\somewhere\AppData\Roaming\npm\node_modules\node\bin来玩一个技巧,它确实获得了新的node.exe but there is no node binary in the current PATH.再次建议使用该--scrip
ts-prepend-node-path选项来包含执行的节点二进制文件npm的路径
Jeb*_*b50 62
就像我说的,替换PATH系统变量中的实际路径并没有完全解决问题,它抱怨二进制文件丢失了.发现这解决了there is no node binary in the current PATH问题,工作.恢复原来的PATH,也工作了.
scripts-prepend-node-path=true是关键,只需在应用程序的根文件夹中创建一个文件,名为.npmrc,将此行放入其中解决了问题:
there is no node binary in the current PATH
god*_*out 36
这是另一种可行的方法: npm config set scripts-prepend-node-path auto
npm 正在尝试使用与其用于运行自身的节点相同的节点。
要解决此冲突,请尝试运行:
npm config set scripts-prepend-node-path true
在Visual Studio 2017中存在此问题,我改为告诉VS始终使用从nodejs.org安装的NodeJS,而不要使用Visual Studio随附的即时冻结版本。(VS2015附带的那个版本太旧了,无法再使用了。)
在Visual Studio中,转到“工具”>“选项”>搜索“外部Web工具”>,并确保“ C:\ Program Files \ nodejs”(或在安装了nodejs.org的位置)位于路径列表中的第一位,并在必要时添加它。
| 归档时间: | 
 | 
| 查看次数: | 19525 次 | 
| 最近记录: |