NodeJS - Npm - set global node_modules

Ever had the problem of 'XXXXX'('yarn') is not recognized as an internal or external command ?!

The solution is as follows:

mkdir %PROGRAMDATA%\npm
npm config set prefix %PROGRAMDATA%\npm
  1. Create a folder in a sensible location to hold the globals (Microsoft is adamant that you shouldn't write to ProgramFiles, so %PROGRAMDATA% seems like the next logical place.
  2. The directory needs to be on the path, so use setx .. /M to set the system path (under HKEY_LOCAL_MACHINE). This is what requires you to run this in a shell with administrator permissions.
  3. Tell npm to use this new path. (Note: folder isn't visible in %PATH% in this shell, so you must open a new window).

npm config ls -l | grep prefix -> This is to list all node_modules configured ... 


Postări populare de pe acest blog

5Inch HDMI LCD for RPI 800x480

DevExpress Theme Changer ...

.NET Core Dependency Injection with Func as constructor parameter