Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 444 Vote(s) - 3.45 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Error "Your cache folder contains root-owned files, due to a bug in previous versions of npm" while "npx create-react-app example_app"

#1
When I was trying to create a new react app using `npx create-react-app example_app`, I get this error

> [Your cache folder contains root-owned files, due to a bug in previous
> versions of npm which has since been addressed sudo chown -R 0:0
> "/root/.npm"]

I even tried to re-install `create-react-app` again using `npm i create-react-app`, it is giving the same kind of
[error][1].


[1]:


I assume after searching about it that it is due to some permissions issue. My current user doesn't have permission to `/home/shubham/.npm` where `shubham` is my username, but I am not so sure about this.

I have tried to solve this error using `chown` command as

sudo chown -R <username>:<groupname> /home/shubham/.npm"

where `<username>` is `Shubham` and `<groupame>` is `1000`, but it is still not working.

Request people to help me out.
If you need any more information, let me know.
Reply

#2
Try `sudo chown -R 1000:1000 "/home/shubham/.npm"`
Reply

#3
This worked for me:
```
sudo npm cache clean --force
```
Reply

#4
It helped me:
Remove and install npm again
Reply

#5
I had the same issue and several others while trying to update my npm packages. I will be honest I do not have enough knowledge of package handlers or why this fixed my situation, but I believe my version of npm and npx were causing the issues. I had errors immediately trying to install npx, node and create-react-app with my old and out of date version of npm.

I could not run `npm install npx -g` without `--force`. Once I did that I also ran `npm install npm -g --force`. After this I could already tell things were different.

After npm and npx were completely overwritten, I ran `npm install node -g` and `npm install create-react-app -g` without any weird problems. I created a new react app and started it error free.

(I also ran the cache command before all of this. `sudo npm cache clean --force` which I am unsure if it helped).
Reply

#6
This is what helped me after going through the above answers. I hope it helps someone else too. After re-reading the npm error prompt, I adjusted the provided command to include the .npm path given in the error message. Below is a copy of my original error messages.

> npm ERR! code EACCES
>
> npm ERR! syscall access
>
> npm ERR! path /home/vagrant/**.npm-global**/lib/node_modules
>
> npm ERR! errno -13
>
> npm ERR!
>
> npm ERR! Your cache folder contains root-owned files, due to a bug in
>
> npm ERR! previous versions of npm which has since been addressed.
>
> npm ERR!
>
> npm ERR! To permanently fix this problem, please run:
>
> npm ERR! sudo chown -R 900:900 "/home/vagrant/.npm"
>
> npm ERR! A complete log of this run can be found in:
>
> npm ERR! /home/vagrant/.npm/_logs/2020-07-09T16_43_35_046Z-debug.log
>
> [ExecStack] Exit code 243 Time 01:03
>
> [error] Executing target-hook frontend-reqs failed.
>
> [error] Command `source:build:frontend-reqs ` exited with code 1.



Instead of using **sudo chown -R 900:900 "/home/vagrant/.npm"**, I used **sudo chown -R 900:900 "/home/vagrant/.npm-global"**. After that, I was able to use the previous command that caused the error with no issues.
Reply

#7

**It work for me now!**

What I did? (**I'm not saying it's the best way to fix this but i'ts working for me. I'm still looking for the best explications for this issue**)

sudo rm -Rf /home/[YOUR_USER_NAME]/.npm-global/lib/node_modules/

and run your command again.

My explication is that it seems like something is corrupted in the node_modules's folder.
As it's not risky to delete it I did it and it works now.
Reply

#8
I also tried all of the above steps on my MAC Catalina, but didn't resolve my issue. These steps resolved my problem:

npm update
npx --ignore-existing create-react-app my-app

Thanks to this [comment][1]


[1]:

[To see links please register here]

Reply

#9
Try `sudo npx create-react-app example_app` or in my case `sudo npm install @vue/cli`

I tried everything else here, but in the end realised that it might just be the command that I was running was not able to escalate the correct permissions.

Reply

#10
This will work:
`sudo chown -R 1000:1000 "~/.npm"`
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through