尝试通过npm安装firebase-admin时出错

时间:2021-11-29 20:27:59

I'm getting an error when I try to install firebase-admin:

我尝试安装firebase-admin时遇到错误:

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:\Users\TOYANSK\AppData\Roaming\npm\node_modules\npm\node_modules\node-
gyp\lib\build.js:258:23)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Windows_NT 10.0.16299
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\TOYANSK\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "build" "--fallback-to-build" "--library=static_library" "--module=C:\\Users\\TOYANSK\\Documents\\Projects\\people\\functions\\node_modules\\grpc\\src\\node\\extension_binary\\node-v48-win32-x64-unknown\\grpc_node.node" "--module_name=grpc_node" "--module_path=C:\\Users\\TOYANSK\\Documents\\Projects\\people\\functions\\node_modules\\grpc\\src\\node\\extension_binary\\node-v48-win32-x64-unknown"
gyp ERR! cwd C:\Users\TOYANSK\Documents\Projects\people\functions\node_modules\grpc
gyp ERR! node -v v6.11.2
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\nodejs\node.exe C:\Users\TOYANSK\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js build --fallback-to-build --library=static_library --module=C:\Users\TOYANSK\Documents\Projects\people\functions\node_modules\grpc\src\node\extension_binary\node-v48-win32-x64-unknown\grpc_node.node --module_name=grpc_node --module_path=C:\Users\TOYANSK\Documents\Projects\people\functions\node_modules\grpc\src\node\extension_binary\node-v48-win32-x64-unknown' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (C:\Users\TOYANSK\Documents\Projects\people\functions\node_modules\grpc\node_modules\node-pre-gyp\lib\util\compile.js:83:29)
node-pre-gyp ERR! stack     at emitTwo (events.js:106:13)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:891:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
node-pre-gyp ERR! System Windows_NT 10.0.16299
node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\TOYANSK\\Documents\\Projects\\people\\functions\\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\TOYANSK\Documents\Projects\people\functions\node_modules\grpc
node-pre-gyp ERR! node -v v6.11.2
node-pre-gyp ERR! node-pre-gyp -v v0.6.39
node-pre-gyp ERR! not ok
Failed to execute 'C:\Program Files\nodejs\node.exe C:\Users\TOYANSK\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js build --fallback-to-build --library=static_library --module=C:\Users\TOYANSK\Documents\Projects\people\functions\node_modules\grpc\src\node\extension_binary\node-v48-win32-x64-unknown\grpc_node.node --module_name=grpc_node --module_path=C:\Users\TOYANSK\Documents\Projects\people\functions\node_modules\grpc\src\node\extension_binary\node-v48-win32-x64-unknown' (1)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! grpc@1.7.3 install: `node-pre-gyp install --fallback-to-build --library=static_library`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the grpc@1.7.3 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!     C:\Users\TOYANSK\AppData\Roaming\npm-cache\_logs\2018-02-09T23_37_53_013Z-debug.log

To solve this problem, I have tried a lot of things, with no success so far:

为了解决这个问题,我尝试了很多东西,到目前为止没有成功:

But nothing changes the final result. I use Windows 10 64-bit, Node.js v6.11.2 (it was 8.4.0), NPM 5.6.0.

但没有任何改变最终结果。我使用Windows 10 64位,Node.js v6.11.2(它是8.4.0),NPM 5.6.0。

A curious fact is that the error also occurs during the firebase init, which allows to continue even after the error in npm install. Maybe for this reason firebase-admin has not been previously installed, even being in the package.json of the functions directory

一个奇怪的事实是错误也发生在firebase init期间,即使在npm install中出错之后也允许继续。也许是因为这个原因firebase-admin以前没有安装过,即使是在functions目录的package.json中也是如此

1 个解决方案

#1


0  

What if you try running npm install -g windows-build-tools in Powershell as admin, as suggested in this answer?

如果您尝试在Powershell中以管理员身份运行npm install -g windows-build-tools,如本答案所示,该怎么办?

Your stack trace includes node-pre-gyp ERR! stack Error: Failed to execute 'C:\Program Files\nodejs\node.exe C:\Users\TOYANSK\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js build ... which most likely means you don't have the node-gyp library installed.

您的堆栈跟踪包括node-pre-gyp ERR!堆栈错误:无法执行'C:\ Program Files \ nodejs \ node.exe C:\ Users \ TOYANSK \ AppData \ Roaming \ npm \ node_modules \ npm \ node_modules \ node-gyp \ bin \ node-gyp.js build。 ..这很可能意味着您没有安装node-gyp库。

The title of the question that answer addresses is npm install that requires node-gyp fails on Windows.

回答地址的问题的标题是npm install,它要求在Windows上使用node-gyp失败。

#1


0  

What if you try running npm install -g windows-build-tools in Powershell as admin, as suggested in this answer?

如果您尝试在Powershell中以管理员身份运行npm install -g windows-build-tools,如本答案所示,该怎么办?

Your stack trace includes node-pre-gyp ERR! stack Error: Failed to execute 'C:\Program Files\nodejs\node.exe C:\Users\TOYANSK\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js build ... which most likely means you don't have the node-gyp library installed.

您的堆栈跟踪包括node-pre-gyp ERR!堆栈错误:无法执行'C:\ Program Files \ nodejs \ node.exe C:\ Users \ TOYANSK \ AppData \ Roaming \ npm \ node_modules \ npm \ node_modules \ node-gyp \ bin \ node-gyp.js build。 ..这很可能意味着您没有安装node-gyp库。

The title of the question that answer addresses is npm install that requires node-gyp fails on Windows.

回答地址的问题的标题是npm install,它要求在Windows上使用node-gyp失败。