1

我为 React native 安装了所有节点模块。当我要构建 iOS 项目时,我在终端上遇到错误

~/WebWork/Project/Project/node_modules/react-native/packager ~
/Users/User/WebWork/Project/Project/node_modules/babel-register/lib/node.js:112
  var opts = new /*istanbul ignore next*/_babelCore.OptionManager().init( /*istanbul ignore next*/(0, _extend2.default)( /*istanbul ignore next*/(0, _cloneDeep2.default)(transformOpts), {
             ^

TypeError: _babelCore.OptionManager is not a function
    at compile (/Users/User/WebWork/Project/MyProject/node_modules/babel-register/lib/node.js:112:14)
    at loader (/Users/User/WebWork/Project/MyProject/node_modules/babel-register/lib/node.js:158:14)
    at Object.require.extensions.(anonymous function) [as .js] (/Users/User/WebWork/Project/MyProject/node_modules/babel-register/lib/node.js:168:7)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Module.require (module.js:367:17)
    at require (internal/module.js:16:19)
    at Object.<anonymous> (/Users/Gaurav/WebWork/Project/TelMed/node_modules/react-native/local-cli/cli.js:16:14)
    at Module._compile (module.js:413:34)
    at Object.Module._extensions..js (module.js:422:10)
~
Process terminated. Press <enter> to close the window

在 iOS 设备上我得到“无法连接到开发服务器”

对于这个问题,我试图做以下过程,但没有什么能从中得到帮助

  1. Clear watchman watches: `watchman watch-del-all`.
  2. Delete the `node_modules` folder: `rm -rf node_modules && npm install`.
  3. Reset packager cache: `npm start -- --reset-cache`.

我很想知道为什么会出现这个错误。

谢谢

4

0 回答 0