无法在新的Win 10 1903中安装expo-cli

时间:2019-12-01 12:43:26

标签: javascript node.js react-native expo

我安装了节点js 13.2,甚至尝试安装yarn。 在Visual Studio安装程序中,我勾选了C ++构建工具和node 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;
    ^

3 个答案:

答案 0 :(得分:0)

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

P.S。

3.5.0有效

npm install -g expo-cli@3.5.0

答案 1 :(得分:0)

执行以下操作: ffmpeg 按照提示。 您可以选择使用Yarn或npm安装。 它对我有用。

答案 2 :(得分:0)

我解决了这个问题,答案很简单:

切勿以管理员权限运行npm