在OSX上的MeanJS安装过程中,node-pre-gyp install –fallback-to-build`失败

我刚刚使用Windows很长一段时间后,自己买了一本mac书。

我正在努力研究我一直在研究的一个MeanJS项目。 在项目上npm install会导致错误

 Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/Users/Aayush/Work/lishn/repo/lishn-alpha/node_modules/grunt-node-inspector/node_modules/node-inspector/node_modules/v8-debug/build/debug/v0.4.6/node-v46-darwin-x64/debug.node --module_name=debug --module_path=/Users/Aayush/Work/lishn/repo/lishn-alpha/node_modules/grunt-node-inspector/node_modules/node-inspector/node_modules/v8-debug/build/debug/v0.4.6/node-v46-darwin-x64' (1) npm ERR! Darwin 15.0.0 npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" npm ERR! node v4.1.1 npm ERR! npm v2.14.4 npm ERR! code ELIFECYCLE > > npm ERR! v8-debug@0.4.6 install: `node-pre-gyp install --fallback-to-build` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the v8-debug@0.4.6 install script 'node-pre-gyp install --fallback-to-build'. npm ERR! This is most likely a problem with the v8-debug package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! node-pre-gyp install --fallback-to-build npm ERR! You can get their info via: npm ERR! npm owner ls v8-debug npm ERR! There is likely additional logging output above. 

我尝试清除caching。

我试着用sudo--unsafe-perm安装node-pre- --unsafe-perm

我也试着重新安装一个MEAN项目,并且有同样的错误。

我似乎无法find问题在这里。

 Node Version - 5.0.0 NPM Version - 3.3.10 

我试过升级node-gyp:

 npm install -g node-gyp 

它为我工作。

我在这里find解决办法,希望能有所帮助。

russfrisch评论4天前:

我遇到了同样的问题。 grunt-node-inspector的版本更改为“> =”而不是“〜”,这对我来说很有用。

链接到我发现这个解决scheme的github页面 。

链接到我的postStackoverFlow

好了,经过一些debugging,以下依赖关系正在使用旧版本的touch

 ./node_modules/bower/node_modules/decompress-zip/package.json: "touch": "0.0.3" ./node_modules/bower/node_modules/lockfile/package.json: "touch": "0" ./node_modules/gulp-nodemon/node_modules/nodemon/package.json: "touch": "1.0.0", ./node_modules/gulp-nodemon/node_modules/touch/package.json: "touch": "./bin/touch.js" ./node_modules/nodemon/package.json: "touch": "~0.0.3", 

有了这个,我可以和节点5一起工作。

这里是我跑的命令的历史:

 git clone https://github.com/meanjs/mean.git cd mean nvm install 5 nvm use 5 npm install which node-gyp npm install -g node-pre-gyp sudo xcodebuild -license npm install 

有一些问题,然后:

我添加了以下行:

#!/usr/bin/env node

到文件顶部./mean/node_modules/.bin/touch

接着:

 npm install 

当然,在重试之前,也许会抛出一个sudo rm -rf ./node_modules && npm cache clean

这可能不适用于所有人,但是我更新了节点,并且在上述情况都没有解决时解决了问题