TL;DR: Clean the npm cache and the package-lock.json
The other day I started to get ENOENT warning when running
npm install like:
[WARNING] npm WARN tar ENOENT: no such file or directory, open '/home/test/app/node_modules/.staging/mydatepicker-b7bb53d9/dist/index.js'
only to have the compilation failing with something like:
[ERROR] npm ERR! code E404
[ERROR] npm ERR! 404 Not Found: @firstname.lastname@example.org
[ERROR] npm ERR! A complete log of this run can be found in:
[ERROR] npm ERR! /home/test/.npm/_logs/2018-09-05T09_23_16_215Z-debug.log
I’ve looked into it and the conclusion was that the error occurred because I’ve updated my node/npm version. Most answers recommend removing the npm cache either via
rm -rf or via
npm cache clean. however, this didn’t fix my problem. This issue seemed to match my behavious and one of the solutions was to remove package-lock.json and regenerate it with
Now, my problem is fixed and I can run yet again
npm install without failing.
Note: I’ve tested it on both linux and windows and it worked.
A little experiment: If you find this post and ad below useful, please check the ad out :-)