【问题标题】:Spawn ENOENT Error with npm install使用 npm install 产生 ENOENT 错误
【发布时间】:2014-03-26 21:26:01
【问题描述】:

每次我尝试运行 npm install 时都会收到 ENOENT 错误,日志如下:

2563 error Error: spawn ENOENT
2563 error     at errnoException (child_process.js:980:11)
2563 error     at Process.ChildProcess._handle.onexit (child_process.js:771:34)
2564 error If you need help, you may report this log at:
2564 error     <http://github.com/isaacs/npm/issues>
2564 error or email it to:
2564 error     <npm-@googlegroups.com>
2565 error System Windows_NT 6.1.7601
2566 error command "c:\\Program Files\\nodejs\\node.exe" "c:\\Program              Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "phantomjs"
2567 error cwd C:\Users\Tyler
2568 error node -v v0.10.12
2569 error npm -v 1.2.32
2570 error syscall spawn
2571 error code ENOENT
2572 error errno ENOENT
2573 verbose exit [ 1, true ]

我已将 npm-debug.log 中的完整日志粘贴到此处:http://pastebin.com/8PB8JRzW

我正在运行 Windows 7 64 位,设置了我的 PYTHON 环境变量,安装了 MSVS2012,安装了 node-gyp,并以管理员身份运行命令行。关于如何让 npm install 工作的任何想法?谢谢!

【问题讨论】:

  • ENOENT 表示找不到文件或目录。您上面的第 2566 行在 Program 和 Files 之间有很大的差距。难道这个路径名是没有找到的吗?您可以尝试安装到路径中没有空格的其他位置。

标签: windows installation npm karma-runner


【解决方案1】:

根据https://github.com/TooTallNate/node-gyp/issues/277#issuecomment-25943524

  1. 确保您的 Python 和节点都是 x86(32 位)或都是 x86-x64(64 位),混合使用会引发此错误

  2. 将环境变量 PYTHON 设置为您的 python.exe,在我的例子中,我在运行 npm 之前运行了“set PYTHON=E:\Python27\python.exe”

【讨论】:

    猜你喜欢
    • 2021-08-31
    • 2016-04-10
    • 2020-02-20
    • 1970-01-01
    • 2017-08-31
    • 2019-11-21
    • 2015-03-12
    • 2013-07-30
    • 1970-01-01
    相关资源
    最近更新 更多