react -env.sh的react-native start EACCESS错误

Sus*_*nde 21 ulimit ios react-native

所以,我在ReactNative中获得了第一个从Windows for Android OS运行的项目.在Mac上进行结账,以相同的方式配置它,并且当我尝试启动react包管理器时使用react-native start并获得以下错误:

child_process.js:506
    throw err;
    ^
Error: spawnSync /Users/UserName/Desktop/Path/node_modules/react-native/local-cli/setup_env.sh EACCES
    at exports._errnoException (util.js:1022:11)
    at spawnSync (child_process.js:461:20)
    at Object.execFileSync (child_process.js:498:13)
    at Object.run (/Users/UserName/Desktop/Path/node_modules/react-native/local-cli/cliEntry.js:156:16)
    at Object.<anonymous> (/usr/local/lib/node_modules/react-native-cli/index.js:117:7)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
Run Code Online (Sandbox Code Playgroud)

我知道它只会尝试将ulimit(打开文件限制)设置为2048,这对非root用户是允许的.还试着用sudo运行命令给它root权限.ulimit -a在机器上运行显示打开文件限制为256,我尝试将默认值2048更改为此.尝试将它增加到4096以及完全删除命令.似乎没有任何区别,错误仍然存​​在.

使用创建一个新项目react-native init DemoProject,打包器似乎从该文件夹开始,所以问题是其他的?

我的package.json是:

{
  "name": "React Native",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest"
  },
  "dependencies": {
    "native-base": "^0.5.18",
    "react": "15.4.1",
    "react-addons-shallow-compare": "^15.4.1",
    "react-native": "0.39.2",
    "react-native-drawer": "^2.3.0",
    "react-native-icons": "^0.7.1",
    "react-native-loading-spinner-overlay": "^0.4.1",
    "react-native-md-textinput": "^2.0.4",
    "react-native-overlay": "^0.5.0",
    "react-native-scrollable-tab-view": "^0.7.0",
    "react-native-tab-view": "0.0.40",
    "react-redux": "^4.4.6",
    "react-timer-mixin": "^0.13.3",
    "redux": "^3.6.0"
  },
  "devDependencies": {
    "babel-jest": "17.0.2",
    "babel-preset-react-native": "1.9.0",
    "jest": "17.0.3",
    "react-test-renderer": "15.4.1"
  },
  "jest": {
    "preset": "react-native"
  }
}
Run Code Online (Sandbox Code Playgroud)

此外,如果重要的是我在全球安装了sinopia,browserify和yarn.

首先,我不确定是否应该再次通过npm在Mac上添加所有本地依赖项,然后只需复制我的代码,或者那应该没问题,还有其他不妥之处.

如果我可以在不重新添加依赖项的情况下对其进行排序,那将会很棒.提前致谢.

Sus*_*nde 72

只需要转到我的基础项目目录并运行

chmod -R 777 node_modules

  • 我正面临这个问题:`child_process.js:504 throw err; ^错误:spawnSync /../AwesomeProject/node_modules/react-native/local-cli/setup_env.sh EACCES` (2认同)

jer*_*rry 10

这是npm 的错误.在修复错误之前,您有两种方法可以解决问题:

  1. 将npm版本降级到5.3.0
  2. 在npm之后我反应原生,运行chmod -R 775 node_modules


red*_*hka 5

就我而言,当我执行以下操作时,错误出在一个特定文件上react-native link

错误:spawnSync ~/native-starter-kit/node_modules/react-native/local-cli/setup_env.sh EACCES

所以我通过chmod +x在该文件上运行: 来修复它。


小智 5

我有同样的问题,我尝试了这个,最初的问题得到了解决

chmod -R 775 安卓