Error
loading dependency graph,done. error: bundling Failed: Error: Unable to resolve module `tty` from `/MyWorks/rnTestTrials/myCurrencySample/node_modules/window-size/index.js`: Module does not exist in the module map This might be related to https://github.com/facebook/react-native/issues/4968 To resolve try the following: 1. Clear watchman watches: `watchman watch-del-all`. 2. Delete the `node_modules` folder: `rm -rf node_modules && npm install`. 3. Reset Metro Bundler cache: `rm -rf /tmp/metro-bundler-cache-*` or `npm start -- --reset-cache`. 4. Remove haste cache: `rm -rf /tmp/haste-map-react-native-packager-*`. at ModuleResolver.resolveDependency (/MyWorks/rnTestTrials/myCurrencySample/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:158:1476) at ResolutionRequest.resolveDependency (/MyWorks/rnTestTrials/myCurrencySample/node_modules/metro/src/node-haste/DependencyGraph/ResolutionRequest.js:92:16) at DependencyGraph.resolveDependency (/MyWorks/rnTestTrials/myCurrencySample/node_modules/metro/src/node-haste/DependencyGraph.js:271:4465) at dependencies.map.relativePath (/MyWorks/rnTestTrials/myCurrencySample/node_modules/metro/src/DeltaBundler/traverseDependencies.js:379:19) at Array.map (<anonymous>) at resolveDependencies (/MyWorks/rnTestTrials/myCurrencySample/node_modules/metro/src/DeltaBundler/traverseDependencies.js:378:16) at /MyWorks/rnTestTrials/myCurrencySample/node_modules/metro/src/DeltaBundler/traverseDependencies.js:203:33 at Generator.next (<anonymous>) at step (/MyWorks/rnTestTrials/myCurrencySample/node_modules/metro/src/DeltaBundler/traverseDependencies.js:296:307) at /MyWorks/rnTestTrials/myCurrencySample/node_modules/metro/src/DeltaBundler/traverseDependencies.js:296:467 BUNDLE [ios,dev] ./index.js ▓▓▓▓▓▓▓▓▓░░░░░░░ 60.2% (291/375),Failed.
–
我在错误中厌倦了给定的解决方案,并删除并重新启动npm
并从“./ios”删除构建并再次运行’react-native run-ios’
厌倦了网络中所有与npm_module相关的解决方案,
versions
react-native-cli: 2.0.1 react-native: 0.54.0
package.json
{ "name": "myCurrencySample","version": "0.0.1","private": true,"scripts": { "start": "node node_modules/react-native/local-cli/cli.js start","test": "jest" },"dependencies": { "color": "2.0.0","moment": "2.18.1","react": "^16.3.0-alpha.1","react-native": "^0.54.0","react-native-extended-stylesheet": "^0.8.1" },"devDependencies": { "babel-jest": "22.4.1","babel-preset-react-native": "4.0.0","jest": "22.4.2","react-test-renderer": "^16.3.0-alpha.1" },"jest": { "preset": "react-native" } }
请帮忙,
我得到了与你完全相同的错误,我意识到在导入不同的模块时,我不小心从’window-size’中导入了这个“import {width};”,这通常发生在IntelliSense为ON时,对于像Visual这样的IED Studio Code导入一行您不打算放置的代码.
因此,要回答您的问题,请查看您的文件,可能是您正在处理的最后一个文件,并检查您是否意外导入了您不打算导入的“窗口大小”模块并删除了该行代码.这就是简短的回答
因此,要回答您的问题,请查看您的文件,可能是您正在处理的最后一个文件,并检查您是否意外导入了您不打算导入的“窗口大小”模块并删除了该行代码.这就是简短的回答
如果您有太多文件要通过,那么您可以暂时删除项目目录中node_modules内的窗口大小文件夹,警告不要永久删除,保持其他安全,并确保关闭地铁捆绑窗口,然后运行“反应本机run-android或ios“再次,地铁捆绑器应该通过一个错误,但这一次,错误将准确显示项目中的哪个文件有问题,一旦找到它,删除该行代码,PUT BACK the窗口大小的文件夹,
然后通过运行“cd android&& ./gradlew clean”清理你的项目,关闭metro捆绑器并再次运行“react-native run-android或ios”,它应该可以工作,