【问题标题】:Angular npm install application failsAngular npm install 应用程序失败
【发布时间】:2019-03-22 16:47:05
【问题描述】:

我收到与许多其他堆栈线程类似的错误。然而,在尝试了许多建议的解决方案之后,我仍然被卡住了。我在跑步

npm install

尝试运行 Angular 应用程序时在克隆的 git 项目文件夹中。这会产生以下错误:

 > grpc@1.10.1 install /Users/my_usrname/my_project/node_modules/grpc

> node-pre-gyp install --fallback-to-build --library=static_library

node-pre-gyp ERR! Tried to download(403): https://storage.googleapis.com/grpc-precompiled-binaries/node/grpc/v1.10.1/node-v64-darwin-x64-unknown.tar.gz 
node-pre-gyp ERR! Pre-built binaries not found for grpc@1.10.1 and node@10.15.3 (node-v64 ABI, unknown) (falling back to source compile with node-gyp) 
node-pre-gyp ERR! Pre-built binaries not installable for grpc@1.10.1 and node@10.15.3 (node-v64 ABI, unknown) (falling back to source compile with node-gyp) 
node-pre-gyp ERR! Hit error Connection closed while downloading tarball file 
  CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/surface/init.o
  CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/surface/init.o
rm: ./Release/.deps/Release/obj.target/grpc/deps/grpc/src/core/lib/surface/init.o.d.raw: No such file or directory
make: *** [Release/obj.target/grpc/deps/grpc/src/core/lib/surface/init.o] Error 1
gyp  CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/avl/avl.o
 ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/my_usrname/.nvm/versions/node/v10.15.3/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:189:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
gyp ERR! System Darwin 18.2.0
gyp ERR! command "/Users/my_usrname/.nvm/versions/node/v10.15.3/bin/node" "/Users/my_usrname/.nvm/versions/node/v10.15.3/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--library=static_library" "--module=/Users/my_usrname/my_project-master/node_modules/grpc/src/node/extension_binary/node-v64-darwin-x64-unknown/grpc_node.node" "--module_name=grpc_node" "--module_path=/Users/my_usrname/my_project-master/node_modules/grpc/src/node/extension_binary/node-v64-darwin-x64-unknown"
gyp ERR! cwd /Users/my_usrname/my_project-master/node_modules/grpc
gyp ERR! node -v v10.15.3
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 '/Users/my_usrname/.nvm/versions/node/v10.15.3/bin/node /Users/my_usrname/.nvm/versions/node/v10.15.3/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --library=static_library --module=/Users/my_usrname/my_project-master/node_modules/grpc/src/node/extension_binary/node-v64-darwin-x64-unknown/grpc_node.node --module_name=grpc_node --module_path=/Users/my_usrname/my_project-master/node_modules/grpc/src/node/extension_binary/node-v64-darwin-x64-unknown' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/Users/my_usrname/my_project-master/node_modules/grpc/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:189:13)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:970:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
node-pre-gyp ERR! System Darwin 18.2.0
node-pre-gyp ERR! command "/Users/my_usrname/.nvm/versions/node/v10.15.3/bin/node" "/Users/my_usrname/my_project-master/node_modules/grpc/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build" "--library=static_library"
node-pre-gyp ERR! cwd /Users/my_usrname/my_project-master/node_modules/grpc
node-pre-gyp ERR! node -v v10.15.3
node-pre-gyp ERR! node-pre-gyp -v v0.7.0
node-pre-gyp ERR! not ok 
Failed to execute '/Users/my_usrname/.nvm/versions/node/v10.15.3/bin/node /Users/my_usrname/.nvm/versions/node/v10.15.3/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --library=static_library --module=/Users/my_usrname/my_project-master/node_modules/grpc/src/node/extension_binary/node-v64-darwin-x64-unknown/grpc_node.node --module_name=grpc_node --module_path=/Users/my_usrname/my_project-master/node_modules/grpc/src/node/extension_binary/node-v64-darwin-x64-unknown' (1)
  CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/backoff/backoff.oe
../deps/grpc/src/core/lib/backoff/backoff.cc:23:10: fatal error: l: Failed to e
      'src/core/lib/gpr/useful.h' file not found
    #include "src/core/lib/gpr/useful.h"

     ^~~~~~~~~~~~~~~~~~~~~~~~~~~

    1 error generated.

make: *** [Release/obj.target/grpc/deps/grpc/src/core/lib/backoff/backoff.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/my_usrname/.nvm/versions/node/v10.15.3/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:189:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
gyp ERR! System Darwin 18.2.0
gyp ERR! command "/Users/my_usrname/.nvm/versions/node/v10.15.3/bin/node" "/Users/my_usrname/.nvm/versions/node/v10.15.3/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--library=static_library" "--module=/Users/myusrname/my_project-master/node_modules/grpc/src/node/extension_binary/node-v64-darwin-x64-unknown/grpc_node.node" "--module_name=grpc_node" "--module_path=/Users/my_usrname/my_project-master/node_modules/grpc/src/node/extension_binary/node-v64-darwin-x64-unknown"
gyp ERR! cwd /Users/my_usrname/my_project-master/node_modules/grpc
gyp ERR! node -v v10.15.3
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
npm WARN @angular/flex-layout@2.0.0-beta.12 requires a peer of @angular/core@~5.1.0 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/flex-layout@2.0.0-beta.12 requires a peer of @angular/common@~5.1.0 but none is installed. You must install peer dependencies yourself.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! grpc@1.10.1 install: `node-pre-gyp install --fallback-to-build -- <pre><code>library=static_library`

npm ERR! Exit status 1

    npm ERR! 

    npm ERR! Failed at the grpc@1.10.1 install script.

    npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

    npm ERR! A complete log of this run can be found in:

    npm ERR!     /Users/my_usrname/.npm/_logs/2019-03-21T19_25_09_711Z-debug.log

我有节点版本v10.15.3,npm 版本6.9.0

关于角度:

Angular CLI: 1.7.4
Node: 10.15.3
OS: darwin x64
Angular: 5.2.4

我已尝试按照某些人的建议卸载节点、重新启动计算机并重新安装节点。正如我在另一个答案中找到的那样,安装了 node-gyp globaly。

不过,我可以运行这个 Angular 应用程序,从 https://angular.io/guide/quickstart 的 Angular 快速入门开始

【问题讨论】:

  • 您是否尝试先安装 grpc@1.10.1 然后再进行 nom install?因为从错误日志中似乎找不到 grpc 的二进制文件。
  • 这里有同样的问题。尝试了许多解决方法,但没有成功。

标签: node.js npm installation angular-cli grpc


【解决方案1】:

这里有两个主要问题。首先,grpc@1.10.1 是一个相当老的库版本,它不支持更新的 Node 10。如果您明确依赖该版本的 grpc 或您的依赖项之一,您应该尝试更新依赖项或让您的依赖项这样做。或者,我相信 grpc 版本支持 Node 8,因此您可以降级您的 Node 版本以使其正常工作。

其次,我从提到的 Angular 猜想你会想在浏览器客户端上运行它。这是行不通的; grpc 根本不适用于浏览器。如果您直接使用 grpc,则可以在浏览器上使用grpc-web

【讨论】:

    猜你喜欢
    • 2017-09-27
    • 2018-05-10
    • 2016-01-22
    • 1970-01-01
    • 2019-02-23
    • 2017-06-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多