【问题标题】:Unable to run NPM INSTALL for a project I cloned from Github after formatting my MAC格式化我的 MAC 后,无法为我从 Github 克隆的项目运行 NPM INSTALL
【发布时间】:2019-07-10 02:07:15
【问题描述】:

这是 sudo npm install 的结果。我不得不格式化我的 MAC 并丢失了一切。我将我的项目推送到我的 github 存储库,然后在本地克隆它。所以现在我正在尝试安装所有依赖项,但出现以下错误。

3 errors generated.
make: *** [Release/obj.target/grpc_node/ext/byte_buffer.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:203:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Darwin 18.6.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--library=static_library" "--module=/Users/anonymous/Development/Mundo1.5/node_modules/grpc/src/node/extension_binary/node-v72-darwin-x64-unknown/grpc_node.node" "--module_name=grpc_node" "--module_path=/Users/anonymous/Development/Mundo1.5/node_modules/grpc/src/node/extension_binary/node-v72-darwin-x64-unknown" "--napi_version=4" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v72"
gyp ERR! cwd /Users/anonymous/Development/Mundo1.5/node_modules/grpc
gyp ERR! node -v v12.6.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: 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 --library=static_library --module=/Users/anonymous/Development/Mundo1.5/node_modules/grpc/src/node/extension_binary/node-v72-darwin-x64-unknown/grpc_node.node --module_name=grpc_node --module_path=/Users/anonymous/Development/Mundo1.5/node_modules/grpc/src/node/extension_binary/node-v72-darwin-x64-unknown --napi_version=4 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/Users/anonymous/Development/Mundo1.5/node_modules/grpc/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:203:13)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:1021:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
node-pre-gyp ERR! System Darwin 18.6.0
node-pre-gyp ERR! command "/usr/local/bin/node" "/Users/anonymous/Development/Mundo1.5/node_modules/grpc/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build" "--library=static_library"
node-pre-gyp ERR! cwd /Users/anonymous/Development/Mundo1.5/node_modules/grpc
node-pre-gyp ERR! node -v v12.6.0
node-pre-gyp ERR! node-pre-gyp -v v0.12.0
node-pre-gyp ERR! not ok 
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 --library=static_library --module=/Users/anonymous/Development/Mundo1.5/node_modules/grpc/src/node/extension_binary/node-v72-darwin-x64-unknown/grpc_node.node --module_name=grpc_node --module_path=/Users/anonymous/Development/Mundo1.5/node_modules/grpc/src/node/extension_binary/node-v72-darwin-x64-unknown --napi_version=4 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72' (1)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! grpc@1.18.0 install: `node-pre-gyp install --fallback-to-build 

【问题讨论】:

    标签: angular firebase cordova ionic-framework


    【解决方案1】:

    确保您对项目文件夹具有正确的权限。您可以使用以下命令来 npm install

    sudo npm install --unsafe-perm
    

    你可以用

    重建node-gyp
    sudo node-gyp rebuild -g --unsafe-perm
    

    【讨论】:

    • 运行 sudo node-gyp rebuild -g --unsafe-perm 会产生以下错误:ERR!堆栈错误:gyp 失败,退出代码:1 ERR!堆栈在 ChildProcess.onCpExit (/usr/local/lib/node_modules/node-gyp/lib/configure.js:323:16) gyp ERR! ChildProcess.emit (events.js:203:13) 的堆栈 gyp ERR!堆栈在 Process.ChildProcess._handle.onexit (internal/child_process.js:272:12) gyp ERR!系统达尔文 18.6.0 gyp ERR!命令“/usr/local/bin/node”“/usr/local/bin/node-gyp”“重建”“-g”“--unsafe-perm”gyp ERR! cwd /Users/anonymous/Development/Mundo1.5
    • 运行 sudo npm install --unsafe-perm 给了我:../../nan/nan_implementation_12_inl.h:356:58: error: expected '(' for function-style cast or type construction ../../nan/nan_object_wrap.h:24:25:错误:'Nan::Persistent<:object void fsevents::initialize> 导出) { 构建错误 gyp ERR!cwd /Users/anonymous/Development//node_modules/grpc npm ERR!grpc@1.18.0 install : `node-pre-gyp install --fallback-to-build --library=static_library
    猜你喜欢
    • 2023-03-21
    • 1970-01-01
    • 2021-03-01
    • 2021-02-10
    • 2013-08-22
    • 2018-08-03
    • 2021-07-05
    • 1970-01-01
    • 2018-07-21
    相关资源
    最近更新 更多