I want to install NestJS with the npm i -g @nestjs/cli command.
npm ERR! code ENOTEMPTY npm ERR! syscall rename npm ERR! path
/usr/local/lib/node_modules/@nestjs/cli npm ERR! dest
/usr/local/lib/node_modules/@nestjs/.cli-seuz8ewr npm ERR! errno -39
npm ERR! ENOTEMPTY: directory not empty, rename
‘/usr/local/lib/node_modules/@nestjs/cli’ ->
‘/usr/local/lib/node_modules/@nestjs/.cli-seuz8ewr’npm ERR! A complete log of this run can be found in: npm ERR!
/root/.npm/_logs/2023-02-18T21_30_24_672Z-debug-0.log
I tried to remove the "node_modules" and renaming the ../cli to /.cli-seuz8ewr and after that it gets killed with:
Killed####⠂⠂⠂⠂⠂⠂⠂⠂⠂) ⠴ reify:fsevents: sill reify mark deleted [ ‘/usr/local/lib/node_modules/@nestjs/cli/node_modules/fseven
What could be the problem?
>Solution :
Welcome to StackOverflow.
The error message you received suggests that there may be a problem with the directory permissions or ownership for the "@nestjs/cli" package. Here are some steps you can try to resolve the issue:
-
Open a terminal and run the command
sudo npm uninstall -g @nestjs/clito uninstall the@nestjs/clipackage. -
Check the ownership of the
/usr/local/lib/node_modulesdirectory by running the commandls -la /usr/local/lib/. Make sure that the owner of the directory is the current user. -
If the ownership of the directory is not correct, you can change it by running
sudo chown -R $(whoami) /usr/local/lib/node_modules. -
Once the ownership is correct, try
npm cache clean --force to clear the npm cache. -
Finally, run
npm i -g @nestjs/clito reinstall the "@nestjs/cli" package.
If the problem persists, you may need to investigate further and possibly seek assistance from the NestJS community or npm support.