Error “Your cache folder contains root-owned files, due to a bug in previous versions of npm” while “npx create-react-app example_app”

前端 未结 9 2477
灰色年华
灰色年华 2021-02-12 21:48

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

9条回答
  •  眼角桃花
    2021-02-12 22:31

    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).

提交回复
热议问题