Module not found: Error:
Can't resolve 'moduleName' in 'D:\Source\node_modules\libraryName\fesm2015'
We've all seen this a thousand times using NG Build. It usually happens after some type of install.
npm install
npm install moduleName
npm clean-install
Usually preceded by deleting node_modules either locally or globally all in attempt to fix one or more (but small) dependency issues.
For any dependency that you were responsible for installing prior to seeing this error. An easy fix is to run npm install. But alas, we find that the message is coming back to haunt us.
Don't feel too bad because any library in NPM which doesn't list peer-dependencies, causes this error! That's right, the package itself of which we have no control is the source!
No matter how many times you try NPM Install or NPM Install packageName it will not work.
How to fix
The only way to cover for missed package dependencies is to install each one manually! When this is done, both the local package.json file and the package-lock.json file receive a new entry.
In essence you are forced to atone for other's lack of effort! However; note that because the pacakge-lock.json file keeps records of all the installs, it too can restore bad packages you don't want. In that case just delete it, type in npm install and you get a fresh start!
Should be easy right? Well just remember one thing with NPM anything is likely and will happen. You will eventually obtain your master degree in NPM.
Don't let NPM stop you! Start looking at Deno?
JWP 2020