Biplob
Biplob

Reputation: 27

Error given in react-native when npm start

I am using Node - v10.6.0 Npm version -4.6.1

When i tried to execute the commad npm start under my project folder, it is giving an error

[email protected] start /mnt/E/react_native/my_app

react-native-scripts start

sh: 1: react-native-scripts: Permission denied npm ERR! code ELIFECYCLE npm ERR! errno 126 npm ERR! [email protected] start:react-native-scripts start npm ERR! Exit status 126 npm ERR! npm ERR! Failed at the [email protected] start script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Please help to rectify the issue

Upvotes: 2

Views: 7209

Answers (7)

wildener
wildener

Reputation: 1

I solved such a problem by making sure that my react-script binary was executable.

$ chmod +x node_modules/.bin/react-scripts

Upvotes: 0

kta
kta

Reputation: 20110

I was having this issue. It was running after executing sudo chmod -R 755 .

Upvotes: 0

muhyidin
muhyidin

Reputation: 335

Try running:

sudo sysctl -w fs.inotify.max_user_instances=1024  
sudo sysctl -w fs.inotify.max_user_watches=12288

before

npm start

This will temporarily increase the number of files that the development server is able to monitor for changes. This solution is specific for Ubuntu/Linux - the macOS equivalent is "kern.maxfiles" and "kern.maxfilesperproc"

Upvotes: 1

Harsha Siriwardana
Harsha Siriwardana

Reputation: 172

I encountered the same issue, Surprisingly it works fine in Windows but failed in Linux giving the same error. Follow below step to resolve this issue.

you need to change package.json file inside your project folder like below instead of default value of "start": "react-scripts start"

"scripts": { "start": "node ./node_modules/react-scripts/bin/react-scripts.js start" }

Upvotes: 1

Sandy.....
Sandy.....

Reputation: 2870

I think you are running your code on MAC. If yes then please try running below command:

sudo chown -R username:groupname directory

where "username" is your current user name, "groupname" is your primary group and "directory" is your project directory path.
Afterwards remove node_modules folder and try below commands:

npm install
npm start

Upvotes: 1

Nikolay Tomitov
Nikolay Tomitov

Reputation: 947

You may not have necessary permissions, so you see:

sh: 1: react-native-scripts: Permission denied

Try starting it with :

sudo react-native-scripts start

Upvotes: 0

David R
David R

Reputation: 15639

If you haven't installed webpack-dev-server please do it by issuing the below command

npm install -g webpack webpack-dev-server

In case if you have already done it, try deleting your node_modules directory and run a fresh npm install before you execute your react-native-scripts start command.

Hope this helps.

Upvotes: 0

Related Questions