为什么有时npm install在Mac上不起作用? [英] why sometimes npm install is not working on mac?
问题描述
我在运行命令时创建了 nodejs 项目 npm install 它因某些错误而失败
I have created nodejs project when i am running command npm install it is failing with some error
同一个项目正在 ubuntu 系统上工作,但是当我在 mac 系统上克隆此代码并尝试运行npm install时,它会由于某些错误而失败
The same project is working on ubuntu system but when i clone this code on mac system and try to run npm install it failed with some error
我认为scrypt模块有些问题,但我不完全知道原因请帮助我,在此先感谢
操作系统:MAC
节点:10.15
Npm:6.0
OS: MAC
Node: 10.15
Npm :6.0
查看以下错误:-
WareWolf:mynodeapp$ npm install
> scrypt@6.0.3 preinstall /node_modules/scrypt
> node node-scrypt-preinstall.js
Error: Error: Command failed: ./configure
configure: error: /node_modules/scrypt/scrypt/scrypt-1.2.0':
configure: error: C compiler cannot create executables
See `config.log' for more details
> scrypt@6.0.3 install /node_modules/scrypt
> node-gyp rebuild
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (/usr/local/Cellar/nvm/0.34.0/versions/node/v10.15.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:182:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:240:12)
gyp ERR! System Darwin 17.7.0
gyp ERR! command "/usr/local/Cellar/nvm/0.34.0/versions/node/v10.15.0/bin/node" "/usr/local/Cellar/nvm/0.34.0/versions/node/v10.15.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /node_modules/scrypt
gyp ERR! node -v v10.15.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! scrypt@6.0.3 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the scrypt@6.0.3 install script.
推荐答案
您将需要删除 package-lock.json
, .npm
和 node_modules
文件夹.
You will need to remove package-lock.json
, .npm
and node_modules
folder.
所需步骤:
npm install npm@latest -g
npm cache clean — force
rm -rf ~/.npm
rm -rf node_modules
rm -f package-lock.json
在 npm install .staging 问题中,当您运行 npm install 时,它会创建 node_modules 文件夹,但所有模块都进入名为 .staging 的子文件夹
In npm install .staging issue, When you run npm install, it creates the node_modules folder but all the modules go into a subfolder called .staging
这篇关于为什么有时npm install在Mac上不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!