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
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 was getting the same error using an older version of Node (v12.7.0) and using Yarn (v1.22.5).
I fixed the problem by using nvm to install the long-term support (LTS) version of Node and then reinstalling the Nest CLI.
nvm install --lts
npm install -g @nestjs/cli
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With