Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

react-native start EACCESS error for setup_env.sh

So, I got my first project in ReactNative to run from Windows for Android OS. Took a checkout on a Mac, configured it in an identical manner and as I try to start the react package manager using react-native start and get the following error:

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)

I am aware that it only tries to set the ulimit (open file limit) to 2048 which is permissible for non root users. Also tried running the command with sudo giving it root permissions. Running ulimit -a on the machine revealed an open file limit of 256 and I tried changing the default 2048 to this. Tried increasing it to 4096 as well removing the command altogether. Seems to make no difference what so ever and the error persists.

Created a new project using react-native init DemoProject and the packager seems to start within that folder so the issue is something else?

My package.json is:

{
  "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"
  }
}

Also, if it matters I have sinopia, browserify and yarn installed globally.

To start with, I am not sure if I should add all local dependencies through npm yet again on the Mac and then just copy my code or that should be fine and something else is amiss.

It would be great if I can sort this out without re-adding dependencies. Thanks in advance.

like image 732
Sushant Sardeshpande Avatar asked Dec 27 '16 13:12

Sushant Sardeshpande


4 Answers

Simply had to go to my base project directory and run

chmod -R 777 node_modules

like image 67
Sushant Sardeshpande Avatar answered Nov 17 '22 14:11

Sushant Sardeshpande


This is a bug of npm. Before they fix the bug, you have 2 way to fix the problem:

  1. Downgrade the npm version to 5.3.0
  2. After npm i react-native, run chmod -R 775 node_modules
like image 36
jerry Avatar answered Nov 17 '22 13:11

jerry


i have the same issue i tried this and the initial issue got fixed

chmod -R 775 android

like image 2
Muhammad Raqib Avatar answered Nov 17 '22 15:11

Muhammad Raqib


in my case the error was with one particular file when i do react-native link:

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

so i fixed it by running: chmod +x on that file.

like image 5
redochka Avatar answered Nov 17 '22 13:11

redochka