I encountered the following error when I tried to install some new packages using npm install
. It happened when I did npm install a-new-package --save
and then delete package-lock.json file afterwards to refresh everything.
npm ERR! code ENOTEMPTY
npm ERR! syscall rename
npm ERR! path /Users/memphismeng/Documents/React Programming/Foot-in-The-Door/mobile/fitd/node_modules/@babel/plugin-proposal-decorators
npm ERR! dest /Users/memphismeng/Documents/React Programming/Foot-in-The-Door/mobile/fitd/node_modules/@babel/.plugin-proposal-decorators-ysLLPQFw
npm ERR! errno -66
npm ERR! ENOTEMPTY: directory not empty, rename '/Users/memphismeng/Documents/React Programming/Foot-in-The-Door/mobile/fitd/node_modules/@babel/plugin-proposal-decorators' -> '/Users/memphismeng/Documents/React Programming/Foot-in-The-Door/mobile/fitd/node_modules/@babel/.plugin-proposal-decorators-ysLLPQFw'
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/memphismeng/.npm/_logs/2021-06-15T18_07_01_162Z-debug.log
What went wrong? I also tried npm audit fix --legacy-peer-deps
but it didn't work.
May be deleting node_modules
folder and package-lock.json
file and then reinstalling npm
would resolve your issue.
So, consider the following commands to apply the above operations:
npm remove node_modules
npm remove package-lock.json
npm install