React Native ios build-修改节点模块包中的文件

React Native ios build-修改节点模块包中的文件,ios,xcode,react-native,Ios,Xcode,React Native,在ios生成属于node_模块包的文件时,我遇到以下错误: 绑定失败:语法错误: /Users/user148634/Desktop/mobile ui/PriceInsight_app/node_modules/react native/node_modules/react native/Libraries/Components/Switch/Switch.js: 不支持实验语法“nullishCoalescingOperator” 当前启用(167:52): 根据此消息,文件位于以下路径中:

在ios生成属于node_模块包的文件时,我遇到以下错误:

绑定失败:语法错误: /Users/user148634/Desktop/mobile ui/PriceInsight_app/node_modules/react native/node_modules/react native/Libraries/Components/Switch/Switch.js: 不支持实验语法“nullishCoalescingOperator” 当前启用(167:52):

根据此消息,文件位于以下路径中:

node_modules/react-native/node_modules/react-native/Libraries/Components/Switch/Switch.js
node_modules/react-native/Libraries/Components/Switch/Switch.js
但是,我可以在以下路径中看到该文件:

node_modules/react-native/node_modules/react-native/Libraries/Components/Switch/Switch.js
node_modules/react-native/Libraries/Components/Switch/Switch.js
(文件夹
node\u modules/react native/node\u modules/react native
不存在)

我试图修改
node\u modules/react native/Libraries/Components/Switch/Switch.js
,但没有任何效果,并且在构建过程中出现了相同的错误

知道为什么会显示不存在的路径吗?知道我如何修改文件以使其影响构建吗?

这是我的package.json文件:

{
  "name": "newapp",
  "version": "0.0.2",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest --verbose --coverage",
    "test:update": "jest --verbose --coverage --updateSnapshot",
    "test:watch": "jest --verbose --watch",
    "coverage": "jest --verbose --coverage && xdg-open ./coverage/lcov-report/index.html",
    "lint": "npx eslint --fix ./src/*"
  },
  "dependencies": {
    "adm-zip": "^0.4.13",
    "apollo-boost": "0.1.17",
    "axios": "^0.18.0",
    "babel": "^6.23.0",
    "buffer": "5.1.0",
    "cross-fetch": "^3.0.0",
    "enzyme": "^3.3.0",
    "fastfall": "^1.5.1",
    "got": "^9.5.1",
    "graphql": "0.13.2",
    "graphql-tag": "2.10.0",
    "jasmine-react-helpers": "^0.2.2",
    "link": "^0.1.5",
    "lodash": "4.17.5",
    "moment": "2.21.0",
    "plist": "^3.0.1",
    "query-string": "^6.1.0",
    "react": "16.2.0",
    "react-addons-test-utils": "^15.6.2",
    "react-apollo": "2.2.4",
    "react-dom": "^16.7.0",
    "react-native": "^0.57.0",
    "react-native-elements": "0.19.0",
    "react-native-fabric": "^0.5.2",
    "react-native-fbsdk": "^0.6.3",
    "react-native-htmlview": "^0.12.1",
    "react-native-link-preview": "^1.3.5",
    "react-native-login": "^0.0.1-alpha.2",
    "react-native-login-keycloak": "^1.0.2",
    "react-native-onesignal": "3.2.6",
    "react-native-push-notification": "https://github.com/Dhanraj-bidchat/react-native-push-notification.git",
    "react-native-sleek-loading-indicator": "^0.1.3",
    "react-native-spinkit": "^1.1.1",
    "react-native-svg": "6.2.2",
    "react-native-swipe-cards": "^0.1.1",
    "react-native-swiper": "1.5.13",
    "react-native-vector-icons": "4.5.0",
    "react-navigation": "1.5.6",
    "react-redux": "5.0.7",
    "redux": "^3.7.2",
    "redux-logger": "^3.0.6",
    "redux-persist": "5.9.1",
    "redux-thunk": "^2.2.0",
    "victory-native": "0.17.2",
    "whatwg-fetch": "2.0.4",
    "xcode": "^1.1.0"
  },
  "devDependencies": {
    "@babel/plugin-proposal-optional-chaining": "^7.2.0",
    "babel-eslint": "^8.2.3",
    "babel-jest": "^22.4.4",
    "babel-plugin-dynamic-import-node": "^1.2.0",
    "babel-plugin-syntax-dynamic-import": "^6.18.0",
    "babel-plugin-transform-class-properties": "^6.24.1",
    "babel-plugin-transform-es2015-modules-commonjs": "^6.26.2",
    "babel-preset-env": "^1.7.0",
    "babel-preset-react-native": "5.0.0",
    "enzyme-adapter-react-16": "^1.1.1",
    "enzyme-to-json": "^3.3.4",
    "eslint": "^4.19.1",
    "eslint-config-standard": "^11.0.0",
    "eslint-plugin-import": "^2.12.0",
    "eslint-plugin-jest": "^21.17.0",
    "eslint-plugin-node": "^6.0.1",
    "eslint-plugin-only-warn": "^1.0.1",
    "eslint-plugin-promise": "^3.8.0",
    "eslint-plugin-react": "^7.9.1",
    "eslint-plugin-standard": "^3.1.0",
    "jest": "^23.5.0",
    "jest-resolve": "^23.0.0",
    "jest-serializer-enzyme": "^1.0.0",
    "react-native-mock-render": "^0.0.26",
    "react-test-renderer": "^16.3.2",
    "redux-mock-store": "^1.5.1",
    "sinon": "^5.0.10"
  },
  "jest": {
    "preset": "react-native",
    "setupFiles": [
      "./jest-setup.js"
    ],
    "snapshotSerializers": [
      "enzyme-to-json/serializer"
    ],
    "modulePaths": [
      "<rootDir>/src",
      "<rootDir>/node_modules"
    ],
    "transform": {
      "^.+\\.js$": "babel-jest",
      "^.+\\.jsx?$": "babel-jest"
    },
    "transformIgnorePatterns": [
      "node_modules/(?!(react-native-safe-area-view|react-navigation|react-native-htmlview|react-native-fabric|react-native-login|react-native-elements|react-native-vector-icons|react-native-spinkit|victory-pie|victory-chart|victory-core|react-native-svg|react-native|redux-persist|victory-native|react-native-swipe-cards|react-native-swiper)/)"
    ],
    "moduleNameMapper": {
      "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/assetsTransformer.js",
      "\\.(css|less)$": "<rootDir>/assetsTransformer.js"
    }
  }
}
{
“名称”:“新应用程序”,
“版本”:“0.0.2”,
“私人”:没错,
“脚本”:{
“开始”:“node node_modules/react native/local cli/cli.js start”,
“test”:“jest--verbose--coverage”,
“test:update”:“jest--verbose--coverage--updateSnapshot”,
“test:watch”:“jest--verbose--watch”,
“coverage”:“jest--verbose--coverage&&xdg open./coverage/lcov report/index.html”,
“lint”:“npx eslint--fix./src/*”
},
“依赖项”:{
“adm-zip”:“^0.4.13”,
“阿波罗助推”:“0.1.17”,
“axios”:“^0.18.0”,
“巴别塔”:“^6.23.0”,
“缓冲区”:“5.1.0”,
“交叉提取”:“^3.0.0”,
“酶”:“^3.3.0”,
“fastfall”:“^1.5.1”,
“got”:“^9.5.1”,
“graphql”:“0.13.2”,
“graphql标签”:“2.10.0”,
“茉莉反应助手”:“^0.2.2”,
“链接”:“^0.1.5”,
“lodash”:“4.17.5”,
“时刻”:“2.21.0”,
“plist”:“^3.0.1”,
“查询字符串”:“^6.1.0”,
“反应”:“16.2.0”,
“react加载项测试实用程序”:“^15.6.2”,
“阿波罗反应”:“2.2.4”,
“react dom”:“^16.7.0”,
“本机反应”:“^0.57.0”,
“反应本机元素”:“0.19.0”,
“react原生结构”:“^0.5.2”,
“react native fbsdk”:“^0.6.3”,
“react native htmlview”:“^0.12.1”,
“反应本机链接预览”:“^1.3.5”,
“反应本机登录”:“^0.0.1-alpha.2”,
“react本机登录密钥斗篷”:“^1.0.2”,
“react native onesignal”:“3.2.6”,
“响应本机推送通知”:https://github.com/Dhanraj-bidchat/react-native-push-notification.git",
“react native sleek loading indicator”:“^0.1.3”,
“react native spinkit”:“^1.1.1”,
“react native svg”:“6.2.2”,
“react本机刷卡”:“^0.1.1”,
“react native swiper”:“1.5.13”,
“反应本机矢量图标”:“4.5.0”,
“反应导航”:“1.5.6”,
“react redux”:“5.0.7”,
“redux”:“^3.7.2”,
“redux记录器”:“^3.0.6”,
“redux持久化”:“5.9.1”,
“redux thunk”:“^2.2.0”,
“胜利土著”:“0.17.2”,
“whatwg fetch”:“2.0.4”,
“xcode”:“^1.1.0”
},
“依赖性”:{
“@babel/插件方案可选链接”:“^7.2.0”,
“babel eslint”:“^8.2.3”,
“巴别塔笑话”:“^22.4.4”,
“babel插件动态导入节点”:“^1.2.0”,
“babel插件语法动态导入”:“^6.18.0”,
“babel插件转换类属性”:“^6.24.1”,
“babel-plugin-transform-es2015-modules-commonjs”:“^6.26.2”,
“巴别塔预设环境”:“^1.7.0”,
“巴别塔预设反应本机”:“5.0.0”,
“酶-适配器-反应-16”:“^1.1.1”,
“酶到json”:“^3.3.4”,
“eslint”:“^4.19.1”,
“eslint配置标准”:“^11.0.0”,
“eslint插件导入”:“^2.12.0”,
“eslint插件笑话”:“^21.17.0”,
“eslint插件节点”:“^6.0.1”,
“仅eslint插件警告”:“^1.0.1”,
“eslint插件承诺”:“^3.8.0”,
“eslint插件反应”:“^7.9.1”,
“eslint插件标准”:“^3.1.0”,
“玩笑”:“^23.5.0”,
“玩笑解决”:“^23.0.0”,
“jest序列化程序”:“^1.0.0”,
“反应本机模拟渲染”:“^0.0.26”,
“反应测试渲染器”:“^16.3.2”,
“redux模拟商店”:“^1.5.1”,
“sinon”:“^5.0.10”
},
“笑话”:{
“预设”:“反应本机”,
“设置文件”:[
“/jest setup.js”
],
“快照序列化程序”:[
“酶到json/序列化程序”
],
“模块路径”:[
“/src”,
“/node\u模块”
],
“转变”:{
“^.+\\.js$”:“巴别塔玩笑”,
“^.+\\.jsx?$”:“巴别塔笑话”
},
“transformIgnorePatterns”:[
“节点|模块/(?!(反应本机安全区域视图|反应导航|反应本机htmlview |反应本机结构|反应本机登录|反应本机元素|反应本机向量图标|反应本机spinkit |胜利派|胜利图|胜利核心|反应本机svg |反应本机|重排持久|胜利本机|反应本机|反应本机刷卡|反应本机刷卡)/)”
],
“moduleNameMapper”:{
“\ \(jpg | jpeg | png | gif | eot | otf | webp | svg | ttf | woff | woff2 | mp4 | webm | wav | mp3 | m4a | aac | oga)$”:“/assettransformer.js,
“\\(css |减去)$”:“/assetsTransformer.js”
}
}
}
将LRC更改为

{
 "presets": ["module:metro-react-native-babel-preset"]
}

添加你的
package.json
你说你得到了一个错误;具体的错误消息是什么?@HeisenBrgadded@JohnEllmore补充