如前所述,我使用yarn作为包管理器,最近将我的应用程序升级到React-Native 0.44.0。我的package.json如下:
{
"name": "Project",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest",
"postinstall": "node_modules/.bin/rn-nodeify --install crypto --hack"
},
"dependencies": {
"assert": "^1.4.1",
"asyncstorage-down": "^3.1.1",
"braintree": "^1.46.0",
"browserify-zlib": "^0.1.4",
"buffer": "^3.6.0",
"console-browserify": "^1.1.0",
"constants-browserify": "0.0.1",
"create-hmac": "^1.1.4",
"dns.js": "^1.0.1",
"domain-browser": "^1.1.7",
"events": "^1.1.1",
"firebase": "^3.6.3",
"global": "^4.3.2",
"https-browserify": "0.0.1",
"jest-haste-map": "^18.1.0",
"jwt-simple": "^0.5.1",
"moment": "^2.17.1",
"os-browserify": "^0.1.2",
"path-browserify": "0.0.0",
"process": "^0.11.9",
"querystring-es3": "^0.2.1",
"react": "16.0.0-alpha.6",
"react-native": "0.44.0",
"react-native-cli": "^2.0.1",
"react-native-crypto": "^2.0.1",
"react-native-facebook-login": "^1.4.0",
"react-native-google-places-autocomplete": "^1.2.6",
"react-native-http": "github:tradle/react-native-http#834492d",
"react-native-level-fs": "^2.0.1",
"react-native-linear-gradient": "1.5.15",
"react-native-looped-carousel": "^0.1.4",
"react-native-maps": "0.12.4",
"react-native-material-kit": "^0.4.1",
"react-native-randombytes": "^2.2.0",
"react-native-router-flux": "3.37.0",
"react-native-svg": ">=5.1.8",
"react-native-svg-uri": "0.0.3",
"react-native-tcp": "^2.0.4",
"react-native-textinput-effects": "^0.2.0",
"react-native-twitter-signin": "github:rakannimer/react-native-twitter-signin",
"react-native-udp": "^1.2.9",
"react-native-vector-icons": "^3.0.0",
"readable-stream": "^1.0.33",
"rn-nodeify": "^6.0.1",
"stream-browserify": "^1.0.0",
"timers-browserify": "^1.4.2",
"tty-browserify": "0.0.0",
"url": "^0.10.3",
"vm-browserify": "0.0.4"
},
"jest": {
"preset": "react-native"
},
"devDependencies": {
"babel-jest": "17.0.2",
"babel-preset-react-native": "1.9.0",
"jest": "17.0.3",
"react-test-renderer": "15.4.1"
},
"react-native": {
"crypto": "react-native-crypto",
"zlib": "browserify-zlib",
"console": "console-browserify",
"constants": "constants-browserify",
"dns": "dns.js",
"net": "react-native-tcp",
"domain": "domain-browser",
"http": "react-native-http",
"https": "https-browserify",
"os": "os-browserify",
"path": "path-browserify",
"querystring": "querystring-es3",
"fs": "react-native-level-fs",
"_stream_transform": "readable-stream/transform",
"_stream_readable": "readable-stream/readable",
"_stream_writable": "readable-stream/writable",
"_stream_duplex": "readable-stream/duplex",
"_stream_passthrough": "readable-stream/passthrough",
"dgram": "react-native-udp",
"stream": "stream-browserify",
"timers": "timers-browserify",
"tty": "tty-browserify",
"vm": "vm-browserify"
},
"browser": {
"crypto": "react-native-crypto",
"zlib": "browserify-zlib",
"console": "console-browserify",
"constants": "constants-browserify",
"dns": "dns.js",
"net": "react-native-tcp",
"domain": "domain-browser",
"http": "react-native-http",
"https": "https-browserify",
"os": "os-browserify",
"path": "path-browserify",
"querystring": "querystring-es3",
"fs": "react-native-level-fs",
"_stream_transform": "readable-stream/transform",
"_stream_readable": "readable-stream/readable",
"_stream_writable": "readable-stream/writable",
"_stream_duplex": "readable-stream/duplex",
"_stream_passthrough": "readable-stream/passthrough",
"dgram": "react-native-udp",
"stream": "stream-browserify",
"timers": "timers-browserify",
"tty": "tty-browserify",
"vm": "vm-browserify"
}
}
运行react-native run-android
成功构建项目,但随后打包器因以下错误而崩溃:
Bundling `index.android.js` 44.9% (327/488), failed.
Error: ENOENT: no such file or directory, open '/Users/chrisdock/Desktop/Jdoe/jdoe-redux/node_modules/react-native-svg/node_modules/react-native/Libraries/Components/AccessibilityInfo/AccessibilityInfo.android.js'
at Object.fs.openSync (fs.js:584:18)
at Object.fs.readFileSync (fs.js:491:33)
at Module._readSourceCode (/Users/chrisdock/Desktop/Jdoe/jdoe-redux/node_modules/react-native/packager/src/node-haste/Module.js:200:29)
at Module._getCacheProps (/Users/chrisdock/Desktop/Jdoe/jdoe-redux/node_modules/react-native/packager/src/node-haste/Module.js:420:29)
at Module._readFromTransformCache (/Users/chrisdock/Desktop/Jdoe/jdoe-redux/node_modules/react-native/packager/src/node-haste/Module.js:376:29)
at Module.readCached (/Users/chrisdock/Desktop/Jdoe/jdoe-redux/node_modules/react-native/packager/src/node-haste/Module.js:363:25)
at Promise.resolve.then (/Users/chrisdock/Desktop/Jdoe/jdoe-redux/node_modules/react-native/packager/src/node-haste/DependencyGraph/ResolutionRequest.js:167:29)
我不确定为什么打包器正在寻找嵌套依赖项而不是node_modules / react-native,或者为什么yarn不会只安装嵌套依赖项,如果这就是它需要做的事情。