react-native start EACCESS error for setup_env.sh
Asked Answered
C

5

27

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.

Camphorate answered 27/12, 2016 at 13:14 Comment(0)
C
96

Simply had to go to my base project directory and run

chmod -R 777 node_modules

Camphorate answered 28/12, 2016 at 8:17 Comment(3)
I'm facing this issue : child_process.js:504 throw err; ^ Error: spawnSync /../AwesomeProject/node_modules/react-native/local-cli/setup_env.sh EACCESBurgonet
@JacoboKoenig, I'm using ubuntu, it was the problem with my node. I uninstalled and cleared all the node.js , npm and node folders from the system. Reinstalled the node again and my problem get solved.Burgonet
This Fixed it for meMadelene
D
10

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
Dionysian answered 5/9, 2017 at 8:21 Comment(0)
E
5

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.

Eatton answered 8/9, 2017 at 8:52 Comment(0)
R
5

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

chmod -R 775 android

Resilient answered 7/2, 2022 at 12:1 Comment(0)
G
0

As jerry pointed out, this is a bug in NPM. There is a fix available now. You can update NPM with npm i -g npm.

I updated to version 5.4.2 (npm --version), removed React Native with npm remove --save react-native and reinstalled RN with npm i --save react-native. This fixed the issue for me.

(As an alternative you might want to try yarn instead of npm.)

Gumboil answered 16/9, 2017 at 20:21 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.