【问题标题】:error in npm installing angularfire2 and firebasenpm 安装 angularfire2 和 firebase 时出错
【发布时间】:2018-04-04 01:08:17
【问题描述】:

我试图像这样使用 npm 安装 angularfire2 和 firebase

$ npm install angularfire2 firebase --save

我遇到的问题是

gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:258:23)
gyp ERR! stack     at emitTwo (events.js:126:13)
gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Windows_NT 10.0.16299
gyp ERR! command "C:\\Program Files (x86)\\nodejs\\node.exe" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "build" "--fallback-to-build" "--library=static_library" "--module=C:\\Users\\New\\Documents\\academy\\academy\\node_modules\\grpc\\src\\node\\extension_binary\\node-v57-win32-x64-unknown\\grpc_node.node" "--module_name=grpc_node" "--module_path=C:\\Users\\New\\Documents\\academy\\academy\\node_modules\\grpc\\src\\node\\extension_binary\\node-v57-win32-x64-unknown"
gyp ERR! cwd C:\Users\New\Documents\academy\academy\node_modules\grpc
gyp ERR! node -v v8.10.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute 'C:\Program Files (x86)\nodejs\node.exe C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js build --fallback-to-build --library=static_library --module=C:\Users\New\Documents\academy\academy\node_modules\grpc\src\node\extension_binary\node-v57-win32-x64-unknown\grpc_node.node --module_name=grpc_node --module_path=C:\Users\New\Documents\academy\academy\node_modules\grpc\src\node\extension_binary\node-v57-win32-x64-unknown' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (C:\Users\New\Documents\academy\academy\node_modules\grpc\node_modules\node-pre-gyp\lib\util\compile.js:83:29)
node-pre-gyp ERR! stack     at emitTwo (events.js:126:13)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:925:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
node-pre-gyp ERR! System Windows_NT 10.0.16299
node-pre-gyp ERR! command "C:\\Program Files (x86)\\nodejs\\node.exe" "C:\\Users\\New\\Documents\\academy\\academy\\node_modules\\grpc\\node_modules\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build" "--library=static_library"
node-pre-gyp ERR! cwd C:\Users\New\Documents\academy\academy\node_modules\grpc
node-pre-gyp ERR! node -v v8.10.0
node-pre-gyp ERR! node-pre-gyp -v v0.7.0
node-pre-gyp ERR! not ok
Failed to execute 'C:\Program Files (x86)\nodejs\node.exe C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js build --fallback-to-build --library=static_library --module=C:\Users\New\Documents\academy\academy\node_modules\grpc\src\node\extension_binary\node-v57-win32-x64-unknown\grpc_node.node --module_name=grpc_node --module_path=C:\Users\New\Documents\academy\academy\node_modules\grpc\src\node\extension_binary\node-v57-win32-x64-unknown' (1)
npm WARN bootstrap@4.0.0 requires a peer of jquery@1.9.1 - 3 but none is installed. You must install peer dependencies yourself.
npm WARN bootstrap@4.0.0 requires a peer of popper.js@^1.12.9 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.3 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! grpc@1.10.1 install: `node-pre-gyp install --fallback-to-build --library=static_library`ild --library=static_library`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the grpc@1.10.1 install script.                  ditional logging output above.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:                T15_46_21_982Z-debug.log
npm ERR!     C:\Users\New\AppData\Roaming\npm-cache\_logs\2018-04-03T15_46_21_982Z-debug.log

我查看了文档并查看了 was a post that mentioned something about the version of grpc@1.10.1 not being good 。我不知道这是否与我的具体问题有关我使用 angular 5 和节点 8.10 我的 npm 版本是 5.6.0 任何关于这里问题的知识将不胜感激。对于有类似问题的人I am also looking into using a cdn for firebase(我的研究还没有完全完成,所以不要相信我的话)。

【问题讨论】:

  • 您能否查看该错误中提到的 npm 日志文件并显示以“node-pre-gyp”开头并提到“grpc”的第一行?我认为那里可能有相关信息。
  • 由于某种奇怪的原因它开始工作我不知道为什么

标签: node.js firebase npm-install angularfire2 grpc


【解决方案1】:

使用这个命令

npm install angularfire2  firebase@4.6.2 --save

【讨论】:

    【解决方案2】:

    如果你仔细观察你会看到这个错误:

    Traceback(最近一次调用最后一次): 文件“./gyp-mac-tool”,第 611 行,在 sys.exit(main(sys.argv[1:])) 文件“./gyp-mac-tool”,第 28 行,在 main exit_code = executor.Dispatch(args) 文件“./gyp-mac-tool”,第 43 行,在 Dispatch 返回 getattr(self, method)(*args[1:]) 文件“./gyp-mac-tool”,第 246 行,在 ExecFilterLibtool 中 如果不是 libtool_re.match(line) 而不是 libtool_re5.match(line): TypeError: 不能在类似字节的对象上使用字符串模式

    这是一个 python 错误。确保路径上有 python 2.7 而不是 3.x,因为此工具不支持 3.x。

    【讨论】:

    • 这可能是它突然开始工作的原因,谢谢我进一步研究了 gyp,您实际上应该在以管理员角色加载 gyp 的依赖项之前运行命令。我这样做了,这可能是它突然开始工作的原因。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-12-13
    • 2021-03-15
    • 2022-08-05
    • 2018-01-25
    • 2018-03-15
    • 2016-06-22
    • 1970-01-01
    相关资源
    最近更新 更多