简体   繁体   English

npm错误:在特定计算机上构建时生成EACCES

[英]npm Error: spawn EACCES when building on specific machine

When running npm run dev using the same source code and configuration on two machines one machine gives the following error: 在两台机器上使用相同的源代码和配置运行npm run dev时,一台机器会出现以下错误:

> node build/dev-server.js

internal/child_process.js:302
    throw errnoException(err, 'spawn');
    ^

Error: spawn EACCES
    at exports._errnoException (util.js:896:11)
    at ChildProcess.spawn (internal/child_process.js:302:11)
    at Object.exports.spawn (child_process.js:367:9)
    at module.exports (/path-to/node_modules/opn/index.js:75:24)
    at Server.<anonymous> (/path-to/build/dev-server.js:81:5)
    at Server.g (events.js:286:16)
    at emitNone (events.js:86:13)
    at Server.emit (events.js:185:7)
    at emitListeningNT (net.js:1272:10)
    at _combinedTickCallback (internal/process/next_tick.js:71:11)
    at process._tickCallback (internal/process/next_tick.js:98:9)
    at Function.Module.runMain (module.js:577:11)
    at startup (node.js:159:18)
    at node.js:444:3

I have permission to run npm and node, I am using node v6.0.0, npm v3.8.6 (on the machine with working install v5.00 and 3.3.6) 我有权运行npm和节点,我正在使用节点v6.0.0,npm v3.8.6(在具有有效安装v5.00和3.3.6的计算机上)

I also get a similar error when trying to run unit tests (npm run unit) 当尝试运行单元测试(npm run unit)时,我也收到类似的错误

Error: spawn karma ENOENT

the build script runs OK though. 构建脚本运行正常。 Here is relevant section from my package.json: 这是我的package.json中的相关部分:

"scripts": {
    "dev": "node build/dev-server.js",
    "build": "node build/build.js",
    "unit": "cross-env BABEL_ENV=test karma start test/unit/karma.conf.js --single-run",

Any ideas? 有任何想法吗?

I got is working by uninstalling node: 我正在通过卸载节点来工作:

 sudo apt-get remove --purge node 

and installing node with nvm (see https://github.com/creationix/nvm for latest) 并使用nvm安装节点(有关最新信息,请参见https://github.com/creationix/nvm

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.1/install.sh | bash

Then installing the same version of node as on my other machine: 然后安装与其他计算机上相同版本的节点:

 nvm install 5.0 

The great thing about NVM is I can install other node versions then use a specific version using this command: 关于NVM的伟大之处在于,我可以安装其他节点版本,然后使用此命令使用特定版本:

nvm use 5.0 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM