所以我想使用 npm 安装一个依赖项,它是 react-native-router-flux,但是由于与 react 和 react-native 的兼容版本,它无法正常工作,所以它是破坏我的项目应用程序。所以我从 package.json 文件中删除了它。
尝试通过以下方式删除它:
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)
我试过 rm -rf/node_modules 100 次,npm install 又试了 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 native-base-shoutem-theme@0.1.3 requires a peer of react@>=15.1.0 but none was installed.
npm WARN @shoutem/animation@0.8.10 requires a peer of react@^15.0.0 but none was installed.
npm WARN react-static-container@1.0.1 requires a peer of react@^0.13.0 || ^0.14.0 || ^15.0.0 but none was installed.
这是由于 native-base 依赖而抛出的:
UNMET PEER DEPENDENCY react@^0.13.0 || ^0.14.0 || ^15.0.0
谁能帮帮我?这快把我逼疯了,我为此“挣扎”了几个小时,我无法继续使用我的应用程序。
提前致谢。
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 react-native@0.43.4 requires a peer of react@16.0.0-alpha.6 but none was installed.
npm WARN native-base-shoutem-theme@0.1.3 requires a peer of react@>=15.1.0 but none was installed.
npm WARN @shoutem/animation@0.8.10 requires a peer of react@^15.0.0 but none was installed.
npm WARN react-static-container@1.0.1 requires a peer of react@^0.13.0 || ^0.14.0 || ^15.0.0 but none was installed.
npm WARN react-test-renderer@16.0.0-alpha.6 requires a peer of react@^16.0.0-alpha.6 but none was installed.
同时在 native-base 上抛出一些 UNMET PEER DEPENDENCY:
├─┬ native-base@2.1.3
│ ├─┬ @shoutem/animation@0.8.10
│ │ ├── hoist-non-react-statics@1.2.0
│ │ └── lodash@4.17.4
│ ├── blueimp-md5@2.7.0
│ ├── clamp@1.0.1
│ ├─┬ color@0.11.4
│ │ ├── clone@1.0.2
│ │ ├─┬ color-convert@1.9.0
│ │ │ └── color-name@1.1.2
│ │ └── color-string@0.3.0
│ ├─┬ fs-extra@2.1.2
│ │ └── jsonfile@2.4.0
│ ├── lodash@4.11.2
│ ├── native-base-shoutem-theme@0.1.3
│ ├── print-message@2.1.0
│ ├── UNMET PEER DEPENDENCY react@^15.0.0
│ ├── react-native-drawer@2.3.0
│ ├── react-native-easy-grid@0.1.7
│ ├── react-native-keyboard-aware-scroll-view@0.2.7
│ ├─┬ react-native-scrollable-tab-view@0.7.4
│ │ ├── UNMET PEER DEPENDENCY react@^0.13.0 || ^0.14.0 || ^15.0.0
│ │ └── react-static-container@1.0.1
│ ├── react-native-vector-icons@4.0.1
│ ├─┬ react-tween-state@0.1.5
│ │ └─┬ raf@3.3.2
│ │ └── performance-now@2.1.0
│ └── tween-functions@1.2.0
├─┬ UNMET PEER DEPENDENCY react@16.0.0-alpha.3
并且在运行时在控制台中,从 XCode 中在模拟器中抛出红屏错误:
没有为关键窗口设置维度
看起来是一个 known issue根据他的github。但是该死的,我不想再使用 react-native-router-flux,我什至没有在我的 package.json 中也没有安装它,但仍然在造成麻烦,这种依赖是一种病毒。
最佳答案
每当您遇到这种情况时,请保持冷静,并想一想在安装核心第三方时安装了所有其他第三方。我在玩 react-native-router-flux 时遇到了类似的问题,它的稳定版本是 v3.38.0。
从上面的问题来看,@shoutem/animation@0.8.10 和 react-static-container@1.0.1 似乎与 react-native 一起出现-router-flux lib.和另一个包即 native-base 与 react@>=15.1.0
所以我得出结论,从 Node 模块中删除 @shoutem 和 react-static-container。如果仍然存在错误,那么我该死的确定错误是因为 native 基础。从项目中完全删除 native base 并等待 native base 更新到最新版本的 react。
尝试以上方法并分享进展,因为这也可以帮助其他人。
注意 1:每当您在安装软件包时看到警告,请不要忽略这些警告,因为它们可能会破坏某些软件包的功能。
使用 npm install package-name@x.y 更新包,其中 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-container 继承自 react-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"
},
干杯 :)
关于ios - 运行 native ios 应用程序时找不到文件依赖错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43817087/
总的来说,我对ruby还比较陌生,我正在为我正在创建的对象编写一些rspec测试用例。许多测试用例都非常基础,我只是想确保正确填充和返回值。我想知道是否有办法使用循环结构来执行此操作。不必为我要测试的每个方法都设置一个assertEquals。例如:describeitem,"TestingtheItem"doit"willhaveanullvaluetostart"doitem=Item.new#HereIcoulddotheitem.name.shouldbe_nil#thenIcoulddoitem.category.shouldbe_nilendend但我想要一些方法来使用
我需要在客户计算机上运行Ruby应用程序。通常需要几天才能完成(复制大备份文件)。问题是如果启用sleep,它会中断应用程序。否则,计算机将持续运行数周,直到我下次访问为止。有什么方法可以防止执行期间休眠并让Windows在执行后休眠吗?欢迎任何疯狂的想法;-) 最佳答案 Here建议使用SetThreadExecutionStateWinAPI函数,使应用程序能够通知系统它正在使用中,从而防止系统在应用程序运行时进入休眠状态或关闭显示。像这样的东西:require'Win32API'ES_AWAYMODE_REQUIRED=0x0
对于具有离线功能的智能手机应用程序,我正在为Xml文件创建单向文本同步。我希望我的服务器将增量/差异(例如GNU差异补丁)发送到目标设备。这是计划:Time=0Server:hasversion_1ofXmlfile(~800kiB)Client:hasversion_1ofXmlfile(~800kiB)Time=1Server:hasversion_1andversion_2ofXmlfile(each~800kiB)computesdeltaoftheseversions(=patch)(~10kiB)sendspatchtoClient(~10kiBtransferred)Cl
Rackup通过Rack的默认处理程序成功运行任何Rack应用程序。例如:classRackAppdefcall(environment)['200',{'Content-Type'=>'text/html'},["Helloworld"]]endendrunRackApp.new但是当最后一行更改为使用Rack的内置CGI处理程序时,rackup给出“NoMethodErrorat/undefinedmethod`call'fornil:NilClass”:Rack::Handler::CGI.runRackApp.newRack的其他内置处理程序也提出了同样的反对意见。例如Rack
我想用ruby编写一个小的命令行实用程序并将其作为gem分发。我知道安装后,Guard、Sass和Thor等某些gem可以从命令行自行运行。为了让gem像二进制文件一样可用,我需要在我的gemspec中指定什么。 最佳答案 Gem::Specification.newdo|s|...s.executable='name_of_executable'...endhttp://docs.rubygems.org/read/chapter/20 关于ruby-在Ruby中编写命令行实用程序
在选择我想要运行操作的频率时,唯一的选项是“每天”、“每小时”和“每10分钟”。谢谢!我想为我的Rails3.1应用程序运行调度程序。 最佳答案 这不是一个优雅的解决方案,但您可以安排它每天运行,并在实际开始工作之前检查日期是否为当月的第一天。 关于ruby-如何每月在Heroku运行一次Scheduler插件?,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/questions/8692687/
exe应该在我打开页面时运行。异步进程需要运行。有什么方法可以在ruby中使用两个参数异步运行exe吗?我已经尝试过ruby命令-system()、exec()但它正在等待过程完成。我需要用参数启动exe,无需等待进程完成是否有任何rubygems会支持我的问题? 最佳答案 您可以使用Process.spawn和Process.wait2:pid=Process.spawn'your.exe','--option'#Later...pid,status=Process.wait2pid您的程序将作为解释器的子进程执行。除
我构建了两个需要相互通信和发送文件的Rails应用程序。例如,一个Rails应用程序会发送请求以查看其他应用程序数据库中的表。然后另一个应用程序将呈现该表的json并将其发回。我还希望一个应用程序将存储在其公共(public)目录中的文本文件发送到另一个应用程序的公共(public)目录。我从来没有做过这样的事情,所以我什至不知道从哪里开始。任何帮助,将不胜感激。谢谢! 最佳答案 无论Rails是什么,几乎所有Web应用程序都有您的要求,大多数现代Web应用程序都需要相互通信。但是有一个小小的理解需要你坚持下去,网站不应直接访问彼此
我尝试运行2.x应用程序。我使用rvm并为此应用程序设置其他版本的ruby:$rvmuseree-1.8.7-head我尝试运行服务器,然后出现很多错误:$script/serverNOTE:Gem.source_indexisdeprecated,useSpecification.Itwillberemovedonorafter2011-11-01.Gem.source_indexcalledfrom/Users/serg/rails_projects_terminal/work_proj/spohelp/config/../vendor/rails/railties/lib/r
刚入门rails,开始慢慢理解。有人可以解释或给我一些关于在application_controller中编码的好处或时间和原因的想法吗?有哪些用例。您如何为Rails应用程序使用应用程序Controller?我不想在那里放太多代码,因为据我了解,每个请求都会调用此Controller。这是真的? 最佳答案 ApplicationController实际上是您应用程序中的每个其他Controller都将从中继承的类(尽管这不是强制性的)。我同意不要用太多代码弄乱它并保持干净整洁的态度,尽管在某些情况下ApplicationContr