首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >React本机无法在任何根中找到条目文件

React本机无法在任何根中找到条目文件
EN

Stack Overflow用户
提问于 2017-06-27 17:42:40
回答 1查看 2.5K关注 0票数 1

描述

将回购程序克隆到一台新计算机上,并得到以下错误:

代码语言:javascript
复制
swipes@0.0.1 start C:\a\swipes-api\mobile
node node_modules/react-native/local-cli/cli.js start

Scanning 722 folders for symlinks in C:\a\swipes-api\mobile\node_modules (30ms)
┌────────────────────────────────────────────────────────────────────────────┐
│  Running packager on port 8081.                                            │
│                                                                            │
│  Keep this packager running while developing on any JS projects. Feel      │
│  free to close this tab and run your own packager instance if you          │
│  prefer.                                                                   │
│                                                                            │
│  https://github.com/facebook/react-native                                  │
│                                                                            │
└────────────────────────────────────────────────────────────────────────────┘
Looking for JS files in
  C:\a\swipes-api\mobile

error: bundling: NotFoundError: Cannot find entry file index.android.js in any of the roots: ["C:\\a\\swipes-api\\mobile"]
    at DependencyGraph._getAbsolutePath (C:/a/swipes-api/mobile/node_modules/react-native/packager/src/node-haste/DependencyGraph.js:280:11)
    at DependencyGraph.getDependencies (C:/a/swipes-api/mobile/node_modules/react-native/packager/src/node-haste/DependencyGraph.js:218:26)
    at Resolver.getDependencies (C:/a/swipes-api/mobile/node_modules/react-native/packager/src/Resolver/index.js:107:27)
    at C:/a/swipes-api/mobile/node_modules/react-native/packager/src/Bundler/index.js:591:37
    at next (native)
    at step (C:\a\swipes-api\mobile\node_modules\react-native\packager\src\Bundler\index.js:12:445)
    at C:\a\swipes-api\mobile\node_modules\react-native\packager\src\Bundler\index.js:12:605
    at process._tickCallback (internal/process/next_tick.js:103:7)
Bundling `index.android.js`  0.0% (0/1), failed.

这条路在搜索的地方是正确的。我已经坚持了一整天了。

这是因为索引文件的路径中有双反斜杠吗?

npm启动-重置-缓存将导致相同的错误。运行纱线后,反应-本机运行-android也会导致同样的问题。npm运行启动--根C:\a\\mobile-没有结果。

这似乎与RN 0.45.0中的前一个问题无关。

更多信息

  • React本地版本: 0.45.1
  • 平台: Android
  • 开发操作系统: Windows

编辑:

所有新项目的反应-本机init导致相同的问题。我的电脑或npm的配置似乎是个问题,但我似乎无法找到这种情况发生的原因。

有什么想法吗?

EN

回答 1

Stack Overflow用户

发布于 2017-07-27 22:41:56

我有这个和一些像窗口上的错误。

更新npmnode帮助我解决了这个问题。

目前我有:

代码语言:javascript
复制
C:\usr\Far>node -v && npm -v
v6.11.1
3.10.10

在我不更新之前,许多试验都没有成功。无论如何,像这样的错误不时地出现。重新开始。在重新启动之前做同样有帮助的事情(但可能不需要,只需重新启动):

代码语言:javascript
复制
sh -c 'rm -rf $TMP/react*'
npm cache clean

其中$TMP是您的系统tmp目录,(检查那里是否存在react文件)

如果您添加或更新了一些包或类似于node_modules目录的修改,也需要这样做:

代码语言:javascript
复制
rm -rf node_modules && npm install
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/44786655

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档