为了账号安全,请及时绑定邮箱和手机立即绑定

'node' 不是内部或外部命令,也不是可运行的程序或批处理文件

'node' 不是内部或外部命令,也不是可运行的程序或批处理文件

守着星空守着你 2021-08-20 18:56:31
我在 Windows 10 中从 git-bash-cli 运行“npm install node-sass”,得到一个“'node'不被识别为内部或外部命令、可运行的程序或批处理文件。” 错误。我多年来一直使用这个设置,当我将节点升级到 10.16.0 时问题就开始了为防止不必要的回复:我看到的所有问题都只是说添加路径变量。我已将 Node 添加到 PATH 变量并尝试了多种不同的编写方式。我最终重新安装了 Node.js 并且它会自动完成,所以我就这样保留了它。node 从命令行运行,而不是从脚本运行,例如 package.json 文件中的脚本。我尝试重新安装节点 8.11.3,这是我在问题开始之前使用的版本,但我遇到了同样的错误。我又回到了 v 10.16.0。错误代码如下:> node-sass@4.12.0 install C:\projects\true\true\website\truevue\node_modules\node-sass> node scripts/install.js'node' is not recognized as an internal or external command,operable program or batch file.npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.0.7 (node_modules\@nuxt\builder\node_modules\fsevents):npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.0.7: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.7 (node_modules\fsevents):npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.7: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})npm ERR! code ELIFECYCLEnpm ERR! errno 1npm ERR! node-sass@4.12.0 install: `node scripts/install.js`npm ERR! Exit status 1npm ERR!npm ERR! Failed at the node-sass@4.12.0 install script.npm ERR! This is probably not a problem with npm. There is likely additional logging output above.npm ERR! A complete log of this run can be found in:npm ERR!     C:\Users\Peter\AppData\Roaming\npm-cache\_logs\2019-07-24T23_41_06_896Z-debug.log
查看完整描述

2 回答

?
墨色风雨

TA贡献1853条经验 获得超6个赞

终于找到了这个问题的答案。我最终做的就是运行npm update -g它解决了这个问题

感谢所有帮助过的人,希望这可以帮助其他人


查看完整回答
反对 回复 2021-08-20
  • 2 回答
  • 0 关注
  • 3887 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信