2017-05-06 39 views
2

所以我想安装一个依赖使用npm这是react-native-router-flux,但由于它不工作,由于兼容性版本与反应& react-native,它是打破我的项目应用。所以我把它从package.json文件中删除。文件未找到依赖性错误,而运行反应原生ios应用程序

企图以将其取出:

npm uninstall --save react-native-router-flux

甚至试图从的package.json文件中手动删除它,但由于某些原因,现在看起来我的整个项目是由于打破。 现在,每当我做npm start

这就是显示在我的终端:

error: bundling: Error: ENOENT: no such file or directory, open '/Users/marian-mac/Documents/dev/example/myapp/node_modules/react-native-router-flux/node_modules/react-native/Libraries/Components/ActivityIndicator/ActivityIndicator.js' 
    at Error (native) 
    at Object.fs.openSync (fs.js:634:18) 
    at Object.fs.readFileSync (fs.js:502:33) 
    at Module._readSourceCode (/Users/marian-mac/Documents/dev/example/myapp/node_modules/react-native/packager/src/node-haste/Module.js:200:29) 
    at Module._getCacheProps (/Users/marian-mac/Documents/dev/example/myapp/node_modules/react-native/packager/src/node-haste/Module.js:420:29) 
    at Module._readFromTransformCache (/Users/marian-mac/Documents/dev/example/myapp/node_modules/react-native/packager/src/node-haste/Module.js:376:29) 
    at Module.readCached (/Users/marian-mac/Documents/dev/example/myapp/node_modules/react-native/packager/src/node-haste/Module.js:363:25) 
    at Promise.resolve.then (/Users/marian-mac/Documents/dev/example/myapp/node_modules/react-native/packager/src/node-haste/DependencyGraph/ResolutionRequest.js:167:29) 
    at process._tickCallback (internal/process/next_tick.js:103:7) 
Bundling `index.ios.js` 94.0% (2941/3033) 

我试图室射频/ node_modules 100倍和NPM安装另一个100倍,这样下去失败和失败,我无法理解哪里试图访问该文件!如果它被删除!

这是我的package.json现在:

{ 
    "name": "myapp", 
    "version": "0.0.1", 
    "private": true, 
    "scripts": { 
    "start": "node node_modules/react-native/local-cli/cli.js start", 
    "test": "jest" 
    }, 
    "dependencies": { 
    "moment": "^2.18.1", 
    "native-base": "^2.1.3", 
    "react": "16.0.0-alpha.6", 
    "react-native": "0.44.0", 
    "react-native-flags": "^1.0.0" 
    }, 
    "devDependencies": { 
    "babel-jest": "19.0.0", 
    "babel-preset-react-native": "1.9.1", 
    "jest": "19.0.2", 
    "react-test-renderer": "16.0.0-alpha.6" 
    }, 
    "jest": { 
    "preset": "react-native" 
    } 
} 

同样是投掷警告,版本和其他的一些东西:

npm WARN [email protected] requires a peer of [email protected]>=15.1.0 but none was installed. 
npm WARN @shoutem/[email protected] requires a peer of [email protected]^15.0.0 but none was installed. 
npm WARN [email protected] requires a peer of [email protected]^0.13.0 || ^0.14.0 || ^15.0.0 but none was installed. 

这被抛出原生基依赖性:

UNMET PEER DEPENDENCY [email protected]^0.13.0 || ^0.14.0 || ^15.0.0 

任何人都可以帮助我吗?这让我疯狂,几个小时一直在与这个“战斗”,而且我无法继续使用我的应用。

在此先感谢。


编辑:

后改变一些版本中为反应,反应天然和天然基。仍然有警告,看起来像打包程序正试图访问react-native-route-flux内的react-native文件。

1)这是我的当前的package.json

{ 
    "name": "myapp", 
    "version": "0.0.1", 
    "private": true, 
    "scripts": { 
    "start": "node node_modules/react-native/local-cli/cli.js start", 
    "test": "jest" 
    }, 
    "dependencies": { 
    "moment": "^2.18.1", 
    "native-base": "^2.1.3", 
    "react": "16.0.0-alpha.3", 
    "react-native": "^0.43.0", 
    "react-native-flags": "^1.0.0" 
    }, 
    "devDependencies": { 
    "babel-jest": "19.0.0", 
    "babel-preset-react-native": "1.9.1", 
    "jest": "19.0.2", 
    "react-test-renderer": "16.0.0-alpha.6" 
    }, 
    "jest": { 
    "preset": "react-native" 
    } 
} 

2)这些是警告:

npm WARN [email protected] requires a peer of [email protected] but none was installed. 
npm WARN [email protected] requires a peer of [email protected]>=15.1.0 but none was installed. 
npm WARN @shoutem/[email protected] requires a peer of [email protected]^15.0.0 but none was installed. 
npm WARN [email protected] requires a peer of [email protected]^0.13.0 || ^0.14.0 || ^15.0.0 but none was installed. 
npm WARN [email protected] requires a peer of [email protected]^16.0.0-alpha.6 but none was installed. 

也会引发一些未满足PEER DEPENDENCY上的本机基:

├─┬ [email protected] 
│ ├─┬ @shoutem/[email protected] 
│ │ ├── [email protected] 
│ │ └── [email protected] 
│ ├── [email protected] 
│ ├── [email protected] 
│ ├─┬ [email protected] 
│ │ ├── [email protected] 
│ │ ├─┬ [email protected] 
│ │ │ └── [email protected] 
│ │ └── [email protected] 
│ ├─┬ [email protected] 
│ │ └── [email protected] 
│ ├── [email protected] 
│ ├── [email protected] 
│ ├── [email protected] 
│ ├── UNMET PEER DEPENDENCY [email protected]^15.0.0 
│ ├── [email protected] 
│ ├── [email protected] 
│ ├── [email protected] 
│ ├─┬ [email protected] 
│ │ ├── UNMET PEER DEPENDENCY [email protected]^0.13.0 || ^0.14.0 || ^15.0.0 
│ │ └── [email protected] 
│ ├── [email protected] 
│ ├─┬ [email protected] 
│ │ └─┬ [email protected] 
│ │ └── [email protected] 
│ └── [email protected] 
├─┬ UNMET PEER DEPENDENCY [email protected] 

并在控制台运行时,从XCode中引发模拟器中的红色屏幕错误:

No Dimension set for key window

看起来它根据自己的GitHub的一个known issue。但该死的,我不想再使用react-native-router-flux了,我甚至没有在我的package.json中安装,也没有安装,并且仍然造成麻烦,这种依赖是病毒。

回答

4

每当你遇到这样的情况时,只要冷静一下,并思考当核心第三方安装时所有其他第三方得到安装。我在使用react-native-router-flux时遇到类似问题,其稳定版本为v3.38.0

从上面的问题看来,@shoutem/[email protected][email protected]附带了react-native-router-flux lib。和其它的包即native-base[email protected]>=15.1.0

,所以我产生的结论兼容,从节点模块移除@shoutemreact-static-container。如果仍然存在错误,那么我确定该错误是由于本地基地。从项目中完全删除native base,然后等待native base更新至最新版本react

尝试上述事情,并请分享进度,因为这可以帮助其他人。注意1:只要你在安装包时看到警告,请不要忽略那些警告,因为它们可能会破坏某些包的功能。

使用npm install [email protected]更新软件包,其中x.y是要安装的版本号。

注2:要安装包yarn是首选。

以下是更新或安装与react-native-router-flux的依赖关系:

"dependencies": { 
    "lodash.isequal": "^4.5.0", 
    "react": "^15.4.2", 
    "react-addons-pure-render-mixin": "^15.4.2", 
    "react-dom": "^15.4.2", 
    "react-native": "^0.41.2", 
    "react-native-experimental-navigation": "0.26.x", 
    "react-native-tabs": "^1.0.9", 
    "react-static-container": "1.0.1" 
    }, 

正如你可以看到react-static-containerreact-native-router-flux继承和其他错误都是因为native-base,看到native-base提供以下相关性。

"dependencies": { 
    "@shoutem/animation": "^0.8.9", 
    "native-base-shoutem-theme": "0.1.3", 
    "blueimp-md5": "^2.5.0", 
    "clamp": "^1.0.1", 
    "color": "~0.11.1", 
    "fs-extra": "^2.0.0", 
    "lodash": "~4.11.1", 
    "print-message": "^2.1.0", 
    "react-native-easy-grid": "0.1.7", 
    "react-native-keyboard-aware-scroll-view": "0.2.7", 
    "react-native-scrollable-tab-view": "^0.7.1", 
    "react-native-vector-icons": "~4.0.0", 
    "react-tween-state": "^0.1.5", 
    "tween-functions": "^1.0.1", 
    "react-native-drawer": "^2.3.0" 
    }, 

干杯:)

+0

谢谢!我会在几个小时内尝试一下,我只需要多睡一会,直到凌晨三点才与之搏斗。再次感谢您花时间!我会保持你的更新。 – msqar

+0

对它进行了测试,即使这些警告来自本机基地,它仍然不会给我反应 - native-router-flux这样的文件或目录,我仍然无法弄清楚为什么,如果它被卸载,甚至不是在我的项目中使用它,为什么它试图获取该文件? :S 在我安装了react-native-router-flux之前,我能够很好地处理包含native-base等的package.json。这就是为什么我知道依赖关系搞砸了我的整个项目。 – msqar

+0

有两个选项可以删除本机基础或更改反应版本。 – Codesingh

相关问题