首页 > 解决方案 > 无法在新的 win 10 1903 中安装 expo-cli

问题描述

我安装了 node js 13.2,我什至尝试安装 yarn。在 Visual Studio 安装程序中,我勾选了 C++ 构建工具和节点 js msbuild。然而,每当我在全球范围内安装 expo-cli 时,我都会收到以下错误:

sharp.cc
  utilities.cc
  win_delay_load_hook.cc
C:\Users\uPanda\AppData\Roaming\npm\node_modules\expo-cli\node_modules\sharp\src\stats.cc(130,1): error C2661: 'v8::Obj
ect::Set': no overloaded function takes 2 arguments [C:\Users\uPanda\AppData\Roaming\npm\node_modules\expo-cli\node_mod
ules\sharp\build\sharp.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:210:5)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:270:12)
gyp ERR! System Windows_NT 10.0.18362
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\uPanda\AppData\Roaming\npm\node_modules\expo-cli\node_modules\sharp
gyp ERR! node -v v13.2.0
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok

最后是:

> envsub@3.1.0 postinstall C:\Users\uPanda\AppData\Roaming\npm\node_modules\expo-cli\node_modules\envsub
> test -d .git && cp gitHookPrePush.sh .git/hooks/pre-push || true

'test' is not recognized as an internal or external command,
operable program or batch file.
'true' is not recognized as an internal or external command,
operable program or batch file.

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: sharp@0.22.1 (node_modules\expo-cli\node_modules\sharp):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: sharp@0.22.1 install: `(node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! envsub@3.1.0 postinstall: `test -d .git && cp gitHookPrePush.sh .git/hooks/pre-push || true`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the envsub@3.1.0 postinstall 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\uPanda\AppData\Roaming\npm-cache\_logs\2019-12-01T12_34_33_996Z-debug.log

C:\Windows\system32>expo
internal/modules/cjs/loader.js:957
    throw err;
    ^

标签: javascriptnode.jsreact-nativeexpo

解决方案


我也有同样的问题。操作系统:Win 10。据我了解,它与 envsub@3.1.0 相关问题已在新版本的 envsub 中得到修复,但 expo-cli 仍使用 3.1.0

附言

3.5.0 作品

npm install -g expo-cli@3.5.0

推荐阅读