升级RN,npm install 报错问题



  • 请问我修改完packager.json里的版本号,然后执行npm install 报错,npm start不了了,如何解决?

    C:\Users\Jeff\test\pengjf>npm install

    utf-8-validate@1.2.1 install C:\Users\Jeff\test\pengjf\node_modules\react-native\node_modules\ws\node_modules\utf-8-validate
    node-gyp rebuild


    C:\Users\Jeff\test\pengjf\node_modules\react-native\node_modules\ws\node_modules\utf-8-validate>if not defined npm_config_node_gyp (node "D:\nodejs\node_modules\npm\bin\node-gyp-bin\....\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "" rebuild )
    在此解决方案中一次生成一个项目。若要启用并行生成,请添加“/m”开关。
    MSBUILD : error MSB4132: 无法识别工具版本“2.0”。可用的工具版本为 "4.0"。
    gyp ERR! build error
    gyp ERR! stack Error: C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe failed with exit code: 1
    gyp ERR! stack at ChildProcess.onExit (D:\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:276:23)
    gyp ERR! stack at emitTwo (events.js:87:13)
    gyp ERR! stack at ChildProcess.emit (events.js:172:7)
    gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
    gyp ERR! System Windows_NT 10.0.10586
    gyp ERR! command "D:\nodejs\node.exe" "D:\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
    gyp ERR! cwd C:\Users\Jeff\test\pengjf\node_modules\react-native\node_modules\ws\node_modules\utf-8-validate
    gyp ERR! node -v v4.4.0
    gyp ERR! node-gyp -v v3.3.0
    gyp ERR! not ok

    bufferutil@1.2.1 install C:\Users\Jeff\test\pengjf\node_modules\react-native\node_modules\ws\node_modules\bufferutil
    node-gyp rebuild

    C:\Users\Jeff\test\pengjf\node_modules\react-native\node_modules\ws\node_modules\bufferutil>if not defined npm_config_node_gyp (node "D:\nodejs\node_modules\npm\bin\node-gyp-bin\....\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "" rebuild )
    在此解决方案中一次生成一个项目。若要启用并行生成,请添加“/m”开关。
    MSBUILD : error MSB4132: 无法识别工具版本“2.0”。可用的工具版本为 "4.0"。
    gyp ERR! build error
    gyp ERR! stack Error: C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe failed with exit code: 1
    gyp ERR! stack at ChildProcess.onExit (D:\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:276:23)
    gyp ERR! stack at emitTwo (events.js:87:13)
    gyp ERR! stack at ChildProcess.emit (events.js:172:7)
    gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
    gyp ERR! System Windows_NT 10.0.10586
    gyp ERR! command "D:\nodejs\node.exe" "D:\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
    gyp ERR! cwd C:\Users\Jeff\test\pengjf\node_modules\react-native\node_modules\ws\node_modules\bufferutil
    gyp ERR! node-gyp -v v3.3.0
    gyp ERR! not ok
    npm WARN optional dep failed, continuing utf-8-validate@1.2.1
    npm WARN optional dep failed, continuing bufferutil@1.2.1

    spawn-sync@1.0.15 postinstall C:\Users\Jeff\test\pengjf\node_modules\react-native\node_modules\yeoman-generator\node_modules\cross-spawn\node_modules\spawn-sync
    node postinstall

    npm WARN optional dep failed, continuing fsevents@1.0.11



  • 升级到 0.24.0后,npm start 居然可以启动了


登录后回复