在OSX上安装MeanJS期间,`node-pre-gyp install --fallback-to-build`失败

aay*_*tha 43 macos node.js npm meanjs

我在使用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.
Run Code Online (Sandbox Code Playgroud)

我试过清除缓存.

我尝试用sudo和安装node-pre-gyp--unsafe-perm

我还尝试重新安装一个MEAN项目,但同样的错误.

我似乎无法找到问题在这里.

Node Version - 5.0.0

NPM Version - 3.3.10
Run Code Online (Sandbox Code Playgroud)

Ann*_*nne 40

我尝试过升级node-gyp:

sudo npm install -g node-gyp
Run Code Online (Sandbox Code Playgroud)

它对我有用.

我在这里找到解决方案,希望它可以提供帮助.

  • 只需添加评论即可。在`npm install -g node-gyp`中,`-g`表示*全局安装*而不是升级它。 (2认同)

Man*_*ons 10

russfrisch 4天前评论:

我遇到了同样的问题.将grunt-node-inspector的版本更改为前缀"> ="而不是"〜",这对我有用.

链接到github页面,我找到了这个解决方案.

链接到StackoverFlow上的帖子

  • 设置`"grunt-node-inspector":节点4.2.2的"~0.4.1"`对我有用 (3认同)

Tad*_*egn 7

这似乎是我的节点升级的问题。不过,我用以下方法解决了这个问题。

首先卸载cli,清除cashe,然后使用这些命令重新安装

npm uninstall -g @angular/cli
npm cache clean
npm install -g @angular/cli
Run Code Online (Sandbox Code Playgroud)

然后安装node-pre-gyp

npm install -g node-pre-gyp
Run Code Online (Sandbox Code Playgroud)

重新启动终端并查看问题是否解决。


oce*_*800 5

这可能并不适合所有人,但我更新了节点,当上述方法都没有解决时,它为我解决了问题


小智 5

经过很多努力,我遇到了同样的问题。这是因为 npm 版本与 gprc 版本不兼容。所以我们需要更新npm。

npm update
npm install 
Run Code Online (Sandbox Code Playgroud)


jmu*_*sch 1

好吧,经过一些调试后,以下依赖项正在使用旧版本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",
Run Code Online (Sandbox Code Playgroud)

这样我就可以让meanJS 与节点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
Run Code Online (Sandbox Code Playgroud)

遇到了一些问题,然后:

我添加了以下行:

#!/usr/bin/env node

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

进而:

npm install
Run Code Online (Sandbox Code Playgroud)

当然,也许可以在重试之前添加一个sudo rm -rf ./node_modules && npm cache clean