5

I have created nodejs project when i am running command npm install it is failing with some error

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

I think there is something with scrypt module but i do't know the reason exactly Please help me, Thanks in advance

OS: MAC
Node: 10.15
Npm :6.0

See error below :-

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.
4

2 回答 2

11

您将需要删除package-lock.json,.npmnode_modules文件夹。

所需步骤:

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 的子文件夹

于 2019-02-05T18:45:47.330 回答
0

当我在我的 linux 机器上启动一个项目时,我发现了同样的问题,我喜欢克隆以从 Mac 上处理它。

为我工作的解决方案:

npm install --no-optional

更多信息:https ://stackoverflow.com/a/47071650/2976796

解决此问题的另一种方法是删除 package-lock.json。

于 2020-08-17T15:08:18.573 回答