从世博会安装安装包时出错

时间:2021-02-27 11:36:23

标签: react-native npm expo node-modules

我正在开发 react-native 项目,在使用 expo install firebase 安装 firebase 时,我不断收到错误:

Installing 1 SDK 40.0.0 compatible native module using npm.
> npm install
npm ERR! code 1
npm ERR! path E:\React-native\new1\node_modules\grpc
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node-pre-gyp install --fallback-to-build --library=static_library
npm ERR! Failed to execute 'C:\Program Files\nodejs\node.exe C:\Users\HP\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --library=static_library --module=E:\React-native\new1\node_modules\grpc\src\node\extension_binary\node-v83-win32-x64-unknown\grpc_node.node --module_name=grpc_node --module_path=E:\React-native\new1\node_modules\grpc\src\node\extension_binary\node-v83-win32-x64-unknown --napi_version=7 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v83 --python=C:\Users\HP\.windows-build-tools\python27\python.exe' (1)
npm ERR! node-pre-gyp info it worked if it ends with ok
npm ERR! node-pre-gyp info using node-pre-gyp@0.14.0
npm ERR! node-pre-gyp info using node@14.16.0 | win32 | x64
npm ERR! node-pre-gyp WARN Using needle for node-pre-gyp https download
npm ERR! node-pre-gyp info check checked for "E:\React-native\new1\node_modules\grpc\src\node\extension_binary\node-v83-win32-x64-unknown\grpc_node.node" (not found)
npm ERR! node-pre-gyp http GET https://node-precompiled-binaries.grpc.io/grpc/v1.24.2/node-v83-win32-x64-unknown.tar.gz
npm ERR! node-pre-gyp http 404 https://node-precompiled-binaries.grpc.io/grpc/v1.24.2/node-v83-win32-x64-unknown.tar.gz
npm ERR! node-pre-gyp WARN Tried to download(404): https://node-precompiled-binaries.grpc.io/grpc/v1.24.2/node-v83-win32-x64-unknown.tar.gz
npm ERR! node-pre-gyp WARN Pre-built binaries not found for grpc@1.24.2 and node@14.16.0 (node-v83 ABI, unknown) (falling back to source compile with node-gyp)
npm ERR! node-pre-gyp http 404 status code downloading tarball https://node-precompiled-binaries.grpc.io/grpc/v1.24.2/node-v83-win32-x64-unknown.tar.gz
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@7.1.2
npm ERR! gyp info using node@14.16.0 | win32 | x64
npm ERR! gyp info ok
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@7.1.2
npm ERR! gyp info using node@14.16.0 | win32 | x64
npm ERR! gyp info find Python using Python version 2.7.15 found at "C:\Users\HP\.windows-build-tools\python27\python.exe"
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! find VS msvs_version not set from command line or npm config
npm ERR! gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
npm ERR! gyp ERR! find VS checking VS2019 (16.1.29102.190) found at:
npm ERR! gyp ERR! find VS "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional"
npm ERR! gyp ERR! find VS - "Visual Studio C++ core features" missing
npm ERR! gyp ERR! find VS checking VS2017 (15.9.28307.586) found at:
npm ERR! gyp ERR! find VS "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community"
npm ERR! gyp ERR! find VS - found "Visual Studio C++ core features"
npm ERR! gyp ERR! find VS - missing any VC++ toolset
npm ERR! gyp ERR! find VS could not find a version of Visual Studio 2017 or newer to use
npm ERR! gyp ERR! find VS looking for Visual Studio 2015
npm ERR! gyp ERR! find VS - not found
npm ERR! gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! find VS **************************************************************
npm ERR! gyp ERR! find VS You need to install the latest version of Visual Studio
npm ERR! gyp ERR! find VS including the "Desktop development with C++" workload.
npm ERR! gyp ERR! find VS For more information consult the documentation at:
npm ERR! gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
npm ERR! gyp ERR! find VS **************************************************************
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Could not find any Visual Studio installation to use
npm ERR! gyp ERR! stack     at VisualStudioFinder.fail (C:\Users\HP\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:121:47)
npm ERR! gyp ERR! stack     at C:\Users\HP\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:74:16
npm ERR! gyp ERR! stack     at VisualStudioFinder.findVisualStudio2013 (C:\Users\HP\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:351:14)
npm ERR! gyp ERR! stack     at C:\Users\HP\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:70:14
npm ERR! gyp ERR! stack     at C:\Users\HP\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:372:16
npm ERR! gyp ERR! stack     at C:\Users\HP\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\util.js:54:7
npm ERR! gyp ERR! stack     at C:\Users\HP\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\util.js:33:16
npm ERR! gyp ERR! stack     at ChildProcess.exithandler (child_process.js:315:5)
npm ERR! gyp ERR! stack     at ChildProcess.emit (events.js:315:20)
npm ERR! gyp ERR! stack     at maybeClose (internal/child_process.js:1048:16)
npm ERR! gyp ERR! System Windows_NT 10.0.19041
npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\HP\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure" "--fallback-to-build" "--library=static_library" "--module=E:\\React-native\\new1\\node_modules\\grpc\\src\\node\\extension_binary\\node-v83-win32-x64-unknown\\grpc_node.node" "--module_name=grpc_node" "--module_path=E:\\React-native\\new1\\node_modules\\grpc\\src\\node\\extension_binary\\node-v83-win32-x64-unknown" "--napi_version=7" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v83" "--python=C:\\Users\\HP\\.windows-build-tools\\python27\\python.exe"
npm ERR! gyp ERR! cwd E:\React-native\new1\node_modules\grpc
npm ERR! gyp ERR! node -v v14.16.0
npm ERR! gyp ERR! node-gyp -v v7.1.2
npm ERR! gyp ERR! not ok
npm ERR! node-pre-gyp ERR! build error
npm ERR! node-pre-gyp ERR! stack Error: Failed to execute 'C:\Program Files\nodejs\node.exe C:\Users\HP\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --library=static_library --module=E:\React-native\new1\node_modules\grpc\src\node\extension_binary\node-v83-win32-x64-unknown\grpc_node.node --module_name=grpc_node --module_path=E:\React-native\new1\node_modules\grpc\src\node\extension_binary\node-v83-win32-x64-unknown --napi_version=7 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v83 --python=C:\Users\HP\.windows-build-tools\python27\python.exe' (1)
npm ERR! node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (E:\React-native\new1\node_modules\grpc\node_modules\node-pre-gyp\lib\util\compile.js:83:29)
npm ERR! node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:315:20)
npm ERR! node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:1048:16)
npm ERR! node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
npm ERR! node-pre-gyp ERR! System Windows_NT 10.0.19041
npm ERR! node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "E:\\React-native\\new1\\node_modules\\grpc\\node_modules\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build" "--library=static_library"
npm ERR! node-pre-gyp ERR! cwd E:\React-native\new1\node_modules\grpc
npm ERR! node-pre-gyp ERR! node -v v14.16.0
npm ERR! node-pre-gyp ERR! node-pre-gyp -v v0.14.0
npm ERR! node-pre-gyp ERR! not ok

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\HP\AppData\Local\npm-cache\_logs\2021-02-27T11_25_59_406Z-debug.log

npm exited with non-zero code: 1
Error: npm exited with non-zero code: 1
    at ChildProcess.completionListener (C:\Users\HP\AppData\Roaming\npm\node_modules\expo-cli\node_modules\@expo\spawn-async\src\spawnAsync.ts:65:13)
    at Object.onceWrapper (events.js:422:26)
    at ChildProcess.emit (events.js:315:20)
    at ChildProcess.cp.emit (C:\Users\HP\AppData\Roaming\npm\node_modules\expo-cli\node_modules\cross-spawn\lib\enoent.js:34:29)
    at maybeClose (internal/child_process.js:1048:16)
    at Socket.<anonymous> (internal/child_process.js:439:11)
    at Socket.emit (events.js:315:20)
    at Pipe.<anonymous> (net.js:673:12)
    ...
    at Object.spawnAsync [as default] (C:\Users\HP\AppData\Roaming\npm\node_modules\expo-cli\node_modules\@expo\spawn-async\src\spawnAsync.ts:26:19)
    at NpmPackageManager._runAsync (C:\Users\HP\AppData\Roaming\npm\node_modules\expo-cli\node_modules\@expo\package-manager\src\NodePackageManagers.ts:162:31)
    at NpmPackageManager.addAsync (C:\Users\HP\AppData\Roaming\npm\node_modules\expo-cli\node_modules\@expo\package-manager\src\NodePackageManagers.ts:105:18)
    at installAsync (C:\Users\HP\AppData\Roaming\npm\node_modules\expo-cli\src\commands\install.ts:130:3)
    at Command.<anonymous> (C:\Users\HP\AppData\Roaming\npm\node_modules\expo-cli\src\exp.ts:347:7)

我也尝试了 npm i -g windows-build-toolsnpm install -g node-gyp

但我不能在其中遇到问题.. 任何人都可以帮我吗?

节点版本- v14.16.0 Npm 版本 - 7.6.0 世博会版本- 4.2.1

1 个答案:

答案 0 :(得分:0)

您首先需要使用此命令清除 npm 缓存

npm cache clean --force

如果它不起作用,则手动删除 %appdata%\npm-cache 文件夹。

然后更新你的 npm

npm install npm@latest -g 

然后你可以尝试通过这个安装expo firebase

expo install firebase

谢谢:)