Don't know why the first day of node. JS dry very smooth, back to the company after the dry point is not smooth, the main reason or the company's network problems, the use of restricted agents, can not directly use NPM from the remote download module, alas.
Node. JS's module load order is first looked up from the Node_modules folder under the project directory and then looked up at one level, you can use the node command under the project directory, and then enter Global.module.paths to view node. JS loads the module in the order.
Node JS installed by default will install NPM,NPM default module folder can use the command NPM root-g to view, or with NPM config get prefix to view, can also be modified by NPM config set prefix
Watch carefully and you will find a magical thing that NPM's default module installation location is not in node. JS Project within the scope of the default lookup, so we need to develop an environment variable Node_path to point to NPM's default module installation location.
Remember to write off the environment variable before it takes effect.
To summarize the reason for this problem is that there are 3
1. Writing errors, often the name of the module is wrong, resulting in a failure to load
2. No related modules installed
3. The relevant module is installed, but it is not set to global, and it is not in the Node_modules directory under the project root directory.
4. Node_path environment variable not set
Problems with node. js cannot find Module xxx