After I installed Nest globally, I tried creating a new project but I got this error Failed to execute command: npm install --silent.
nest new new_project
Same here. No answer was helpful to me. I got it working by:
nest new test-project
cd test-project
npm install @types/[email protected]
npm install
npm have permissions by this command sudo chown -R $(whoami) ~/.npmsudo nest new project and it solved the issue.Is a problem whit Urix module https://github.com/lydell/urix#deprecated
Try:
npm cache clean --force
npm i -g source-map-resolve
npm i -g @nestjs/cli
nest new project_name
I encountered this issue on my Linux desktop.
When the error occurs?
The error occurs after the nest CLI created the project skeleton and moved to the dependencies installation with npm / yarn.
Debugging
After running next new <project-name> I accessed the new create folder (project-name) and tried to run npm install from there:
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 1000:1000 "/home/my-user/.npm"
npm ERR! code EACCES
npm ERR! syscall open
npm ERR! path /home/my-user/.npm/_cacache/tmp/ef585472
npm ERR! errno -13
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 1000:1000 "/home/my-user/.npm"
The cause of the error
The problem in my case was related to permissions to the _cache folder inside the .npm folder of the current user path.
Solution:
I fixed this by simply running:
sudo chown -R 1000:1000 /home/my-user/.npm/_cache
Then running npm install inside the failed project folder.
On new project the problem should not occur.
Additional information:
1 ) Running npm cache clean --force gave me the exact same error which npm install produced.
2 ) Running next new <project-name> with sudo might be a workaround but it is better to solve the permissions issues without running the process with sudo.
Versions I used:
I'm working with:
$nest -v
7.5.3
$node -v
v12.19.0
I got the same error.
Failed to execute command: npm install --silent
× Installation in progress... ☕
🙀 Packages installation failed, see above
I have tried all the solution mentioned here nothing worked for me, so I decided to uninstall node and reinstall it.
To uninstall node I refer this https://stackoverflow.com/a/20711410/15543025.
Previously i was using
node version: 16.6.2
npm version: 7.20.6
After uninstalling node I installed LTS version of node(i.e v14.17.5), it includes npm version: 6.14.14.
Don't know what the actual problem was but it is working fine on older versions of npm. This could be a possible workaround.
If you are on a mac it might be possible that you have installed node with brew. In this case try to remove this by uninstalling node:
brew uninstall --force node
Then install node again using the official website: https://nodejs.org/en/
In my case I had 2 installations of node running which caused this error.
I hope it helps!
Just use "sudo"
sudo nest new <project-name>
This is the issue between conflicts of versions of nodejs and nestjs
I had the same issue . I then updated my node version to lattest LTS and then installed nest-cli globbaly. everything then works perfectly. This is not the problem with your OS it is with internal dependencies of NestJS
sudo nest new project-name
try to create the project with admin privileges using sudo at the start. this worked for me
I encountered this issue, what I realized was that I had installed yarn globally and it had created a package.json and a yarn.lock file in my user directory which was causing some form of conflicts with the creation of new project. I solved this issue by removing both package.json and the yarn.lock file
rm /Users/your_username/package.json
rm /Users/your_username/yarn.lock
After that, switch to your project directory and run;
yarn install
or
npm install