NodeJS and NPM troubleshooting
Be aware of any kind of error!
NodeJS and NPM on Windows can be really terrible. I'm having many problems with PCs running Windows 8 and 10. Fixing writing permissions is boring and annoying when you don't know what is the source of the problem. The npm behaviour is unpredictable and it seems it gives you always a different answer or error.
NPM install problems
This is one of the most common and annoying errors. If you see this on your command line:
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall scandir
npm ERR! Error: EPERM: operation not permitted, scandir:
- use npm ALWAYS with an admin shell on windows. Give the right permissions on Linux.
- Close all processes, ng serve or other operations if possibile. This will prevent to keep npm busy but it can be boring when you must restart all processes every time.
- Once you have your app installed, install only the package you need and avoid npm install again if you can. This because you will not need to run a complete installation of all packages.
- Update NodeJS only if you are sure your app will continue to work correctly with both Node and NPM new versions
Avoid NPM update
This will let you to avoid npm to update all packages of your application without knowing if your dependencies and especially your web application is really ready to support the updated packages. Use Greenkeeper instead: this amazing platform will keep track of your dependencies and it can update your package.json file automatically. Write your tests and let Greenkeeper to run them for you! It will test your application and it will inform you if the updated packages are OK or not.
I feel sorry for all developers like me that must work with IE anyway. You know that many user are still using this horrible browser and you must set all polyfills correctly. In this case I suggest to test your app with IE before switching to Chrome or every other good browser\s.
I have had many problems with a big application on iPad, tablets or Android. Luckily Node and Npm are not responsible for any of this problems but be sure to test your app for all devices. This can be a great challenge but it is necessary if you are developing a large applications for a customer or your company.
The Angular documentation on the official website is really poor and it doesn't help you in any cases. Most people are using NgCli and there is no way to find a good documentation for all configurations and problems with NPM.
Be sure to read any online documentation in any case: if you are using Angular, ReactJS or VueJS. Be sure to solve all problems above, especially for browsers and multiple devices and your app will be great!