facebook / create-react-app

Set up a modern web app by running one command.
https://create-react-app.dev
MIT License
102.78k stars 26.87k forks source link

npm start EACCES permission denied #12895

Open stevebanik opened 1 year ago

stevebanik commented 1 year ago

npm start fails with the error below:

Compiled with problems:X

ERROR in ./src/logo.svg

Module build failed (from ./node_modules/@svgr/webpack/lib/index.js): Error: EACCES: permission denied, open '/Users/stacktrace/.config/svgrrc'

Dhruwang commented 1 year ago

Try this command : sudo npm install -g --unsafe-perm=true --allow-root

Techboy000 commented 1 year ago

This worked for me: Step 1: Go->Computers->MacintoshHD->Users->{username of PC}-> Step 2: Press ('command' + 'shift' + '.') to show a hidden file on your PC. Step 3: Click on '.config' ->get info-> sharing and permission->click on the lock bar and provide your system password -> click on '+' sign -> user and guest->select your {user name} and select privileges to read and write. That's it it will definitely work. https://stackoverflow.com/questions/74637371/how-resolve-permission-denied-problem-while-launching-react-app-using-npm-start

ginobean commented 1 year ago

Remarkably, for me, on Ubuntu Linux, it seems to make a difference what subsuming directory I build/run the new react app from under.

For example, if I create the new react app under /home/gino/ , I am able to build/run it fine. npm run build

py[3.10.9] gino@gino-dell:~/goodbar
(master) $ npm run build 

> goodbar@0.1.0 build
> react-scripts build

Creating an optimized production build...
Compiled successfully.

As a test I recursively copied this goodbar directory to a different mount point.

py[3.10.9] gino@gino-dell:~/goodbar
(master) $ cd /docs/other/
 py[3.10.9] gino@gino-dell:/docs/other
 $ ls
 py[3.10.9] gino@gino-dell:/docs/other
 $ cp -a ~/goodbar .
 py[3.10.9] gino@gino-dell:/docs/other
 $ cd goodbar/
 py[3.10.9] gino@gino-dell:/docs/other/goodbar
(master) $ npm run build 

> goodbar@0.1.0 build
> react-scripts build

Creating an optimized production build...
Failed to compile.

Error: EACCES: permission denied, open '/.config/svgrrc'

My mount points include:

 py[3.10.9] gino@gino-dell:/docs/other/goodbar
(master) $ df2
Filesystem               Size  Used Avail Use% Mounted on
/dev/sdb5                 44G   32G   10G  77% /
/dev/sdb6                193G   65G  118G  36% /home
/dev/sda1                916G  842G   28G  97% /docs
judeshin commented 1 year ago

This worked for me: Step 1: Go->Computers->MacintoshHD->Users->{username of PC}-> Step 2: Press ('command' + 'shift' + '.') to show a hidden file on your PC. Step 3: Click on '.config' ->get info-> sharing and permission->click on the lock bar and provide your system password -> click on '+' sign -> user and guest->select your {user name} and select privileges to read and write. That's it it will definitely work. https://stackoverflow.com/questions/74637371/how-resolve-permission-denied-problem-while-launching-react-app-using-npm-start

@Techboy000 You're my lifesaver! Thanks! Is this a safe way to clear such permission issues?

Thejaswini-Rao-U commented 6 months ago

Hi Anyone please let me know, how to resolve this issue in ubuntu 20.04 ?

im stuck with this issue from 3 days, tried giving permission but not working.

Please find below error page, this error occurs when im starting the npm i have installed react and version is 18

react-start-error

AumaujayaSiddhi commented 4 months ago

I have got a different error here, which got resolved by changing the permissions of cache file under node_modules folder

xushijie commented 3 months ago

Hi Anyone please let me know, how to resolve this issue in ubuntu 20.04 ?

im stuck with this issue from 3 days, tried giving permission but not working.

Please find below error page, this error occurs when im starting the npm i have installed react and version is 18

react-start-error

Have the same issue when running npm run build. It is easy to chmod the directory attributes. However, anyone can tell me where to change the directory configuration, e..g, change /.config to another directory