node.js `node-pre-gyp install --fallback-to-build` 在 OSX 上的 MeanJS 安装过程中失败
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/33463945/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
`node-pre-gyp install --fallback-to-build` failed during MeanJS installation on OSX
提问by aayush shrestha
I just bought myself a mac book after using Windows for a long time.
在使用 Windows 很长时间后,我刚刚给自己买了一本 mac book。
I was trying to work on a MeanJS project that I had been working on.
Doing npm installon the project throws error
我正在尝试从事我一直在从事的 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! [email protected] install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] 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.
I tried clearing cache.
我尝试清除缓存。
I tried installing node-pre-gyp with sudoand --unsafe-perm
我尝试使用sudo和安装 node-pre-gyp--unsafe-perm
I also tried to fresh install a MEAN project, with the same error.
我还尝试全新安装 MEAN 项目,但出现相同的错误。
I can't seem to find what the problem is here.
我似乎无法在这里找到问题所在。
Node Version - 5.0.0
NPM Version - 3.3.10
回答by Anne
回答by ManyQuestions
russfrisch commented 4 days ago:
russfrisch 4 天前评论:
I was experiencing this same issue. Changing in the version for grunt-node-inspector to prepend a ">=" instead of a "~" got this to work for me.
我遇到了同样的问题。更改 grunt-node-inspector 的版本以添加 ">=" 而不是 "~" 使其对我有用。
Link to github pagewhere I found this solution.
链接到我找到此解决方案的github 页面。
回答by Vishal Chavan
I was gone through same problem solved after lot efforts. It is because of npm version is not compatible with gprc version. So we need to update the npm.
经过很多努力,我遇到了同样的问题。这是因为 npm 版本与 gprc 版本不兼容。所以我们需要更新npm。
npm update
npm install
回答by ocean800
This might not work for everyone, but I updated node and it fixed the issue for me when none of the above did
这可能不适用于每个人,但我更新了节点,并在以上均未解决时为我解决了问题
回答by Tadele Ayelegn
This seems issue with my node upgrade. How ever I solved it with the following approach.
这似乎是我的节点升级的问题。我如何用以下方法解决它。
First uninstall the cli, clear cashe, and reinstall with these commands
首先卸载cli,清除cashe,然后用这些命令重新安装
npm uninstall -g @angular/cli
npm cache clean
npm install -g @angular/cli
Then install node-pre-gyp
然后安装 node-pre-gyp
npm install -g node-pre-gyp
Restart your terminal and see if the issue is solved.
重新启动您的终端,看看问题是否已解决。
回答by Jacopo
Hope my scenario can help someone else.
I had the same problem with the package bcrypt. First, I have tried with npm i -g node-gypas suggested by Anne but the problem persisted. Then I read again the error message to have a better understanding of the problem and discovered that the script fails to build the package from scratch - since a precompiled version doesn't exist. In particular, it can't find the g++ command so I solved installing the build-essentialpackage with sudo apt install build-essential -y.
希望我的场景可以帮助别人。我对包 bcrypt 有同样的问题。首先,我npm i -g node-gyp按照安妮的建议尝试过,但问题仍然存在。然后我再次阅读错误消息以更好地理解问题并发现脚本无法从头开始构建包 - 因为预编译版本不存在。特别是,它找不到 g++ 命令,所以我解决了build-essential使用sudo apt install build-essential -y.
回答by wizzfizz94
Following command work for me:
以下命令对我有用:
sudo npm i -g node-pre-gyp
回答by enthusiasticgeek
As @ocean800 stated I updated node. The below solution is for Ubuntu 16.04 that worked for me, but something similar on OSX may fix this issue.
正如@ocean800 所说,我更新了节点。以下解决方案适用于对我有用的 Ubuntu 16.04,但 OSX 上的类似解决方案可能会解决此问题。
On Ubuntu 16.04, what worked for me was upgrading node
在 Ubuntu 16.04 上,对我有用的是升级节点
updating nodejs on ubuntu 16.04
I am replicating solution from the above link below
我正在从下面的链接复制解决方案
To update, you can install n
要更新,您可以安装 n
sudo npm install -g n
Then just :
然后只是:
sudo n latest
or a specific version
或特定版本
sudo n 8.9.0
Then try and install
然后尝试安装
sudo npm install <package>
回答by jmunsch
Alright so after some debugging the following dependencies are using an older version of touch:
好的,经过一些调试后,以下依赖项使用的是旧版本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",
With that I was able to get meanJS working with node 5.
这样我就可以让 meanJS 与节点 5 一起工作。
Here is the history on the commands I ran:
这是我运行的命令的历史记录:
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
Had some issues and then:
遇到了一些问题,然后:
I added the following line:
我添加了以下行:
#!/usr/bin/env node
#!/usr/bin/env node
To the top of the file ./mean/node_modules/.bin/touch
到文件顶部 ./mean/node_modules/.bin/touch
And then:
进而:
npm install
And of course maybe throw in a sudo rm -rf ./node_modules && npm cache cleanbefore retrying.
当然,sudo rm -rf ./node_modules && npm cache clean在重试之前可能会抛出一个。
回答by Rana Jahid
i also face same problem.i found solution for that.
我也面临同样的问题。我找到了解决方案。
bcrypt required C++, python and node-pre-gyp.
bcrypt 需要 C++、python 和 node-pre-gyp。
sudo apt-get install g++
sudo apt-get install -y build-essential python
npm install node-pre-gyp
for more details check : https://github.com/kelektiv/node.bcrypt.js/wiki/Installation-Instructions#ubuntu-and-derivatives---elementary-linux-mint-etc
有关更多详细信息,请查看:https: //github.com/kelektiv/node.bcrypt.js/wiki/Installation-Instructions#ubuntu-and-derivatives---elementary-linux-mint-etc

