【问题标题】:React-native connection errorsReact-native 连接错误
【发布时间】:2015-10-08 18:40:57
【问题描述】:

我正在尝试在 React Native 中启动一个新项目,但是当我尝试启动 iOS 模拟器时出现错误。我没有编辑 index.ios.js。我正在使用iOS模拟器运行项目,模拟器中的错误是'Could not connect to development server...'

在 /Users/jeff/Documents/TestApp 中寻找 JS 文件

错误 EACCES,权限被拒绝 '/Users/jeff/.babel.json' {"errno":-13,"code":"EACCES","path":"/Users/jeff/.babel.json","syscall":"open"} 错误:EACCES,权限被拒绝'/Users/jeff/.babel.json' 在错误(本机) 在 Object.fs.openSync (evalmachine.:500:18) 在 Object.fs.writeFileSync (evalmachine.:1099:15) 保存时(/Users/jeff/Documents/TestApp/node_modules/react-native/node_modules/babel-core/lib/api/register/cache.js:35:19) 在 process._tickCallback (node.js:355:11) 在 Function.Module.runMain (module.js:503:11) 启动时 (node.js:129:16) 在 node.js:814:3

http://facebook.github.io/react-native/docs/troubleshooting.html 常见问题和解决方案。评估机器:565 fs.write = 函数(fd,缓冲区,偏移量,长度,位置,回调){ ^ 错误:EACCES,权限被拒绝'/Users/jeff/.babel.json' 在错误(本机) 在 Object.fs.openSync (evalmachine.:500:18) 在 Object.fs.writeFileSync (evalmachine.:1099:15) 在 process.save (/Users/jeff/Documents/TestApp/node_modules/react-native/node_modules/babel-core/lib/api/register/cache.js:35:19) 在 process.emit (events.js:107:17) 在 process.exit (node.js:600:17) 在过程中。 (/Users/jeff/Documents/TestApp/node_modules/react-native/packager/packager.js:143:11) 在 process.emit (events.js:107:17) 在 process._fatalException (node.js:236:26) 进程终止。按下关闭窗口

【问题讨论】:

  • 您是否安装了Watchman,是否在使用iojs
  • 是的,用 brew 安装了守望者。我不得不单独安装iojs
  • 我卸载了所有东西,然后重新安装了 brew、iojs、nvm 和 npm。现在,当我尝试在模拟器上运行项目时,出现此错误: packager.sh: line 19: node: command not found

标签: node.js react-native


【解决方案1】:

我已经解决了这个问题,然后执行以下命令

sudo chmod 777 ~/.babel.json

然后重新初始化react-native项目,就成功了。

【讨论】:

【解决方案2】:

你可以试试

nvm alias default iojs-v2

如果这不起作用,请尝试再次执行 installation guide 中的所有步骤。然后在你的项目文件夹中

rm -rf node_modules/
npm i

在 Xcode 中,从您的库中删除 RCTWebSocketDebuggerYourProject > Libraries > RCTWebSocketDebugger

然后在 Xcode 中 Product -> Clean 并尝试再次构建

【讨论】:

    【解决方案3】:

    授予路径~/.babel.json 的管理员权限应该会有所帮助。试试这个命令:

    sudo chmod 777 ~/.babel.json
    

    【讨论】:

      猜你喜欢
      • 2021-04-12
      • 1970-01-01
      • 2023-01-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-09-17
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多