You can edit the code based on your needs. This code removes node_modules folder, package-lock.json yarn.lock etc. If you don’t have any of those files, you may possibly get an error. Just delete the part from code containing the filename which doesnt exist in your path already.
rm -rf node_modules && rm -rf **/node_modules && rm -rf package-lock.json && rm -rf yarn-error.log && rm -rf yarn.lock && npm cache clean --force && npm i
For example, if you don’t have yarn.lock file, or any kind of yarn related file, if console throws error about yarn when you run the code, remove && rm -rf yarn.lock and other yarn related commands. Run updated code.
Example:
rm -rf node_modules && rm -rf **/node_modules && rm -rf package-lock.json && npm cache clean --force && npm i
Leave a Reply