How to fix npm should be run outside of the node repl, in your normal shell issue

After installing node in the windows environment, there will be a node.exe file in its directory structure. Running this tool is equivalent to executing the node command in cmd, that is, entering the node development mode.

Node installation directory

But you can't execute npm commands here, because npm, as an independent module, is actually another tool. If you execute the npm install installation command at this time, node will throw  npm should be run outside of the node repl, in your normal shell.  exception. This actually means that commands such as npm cannot be run in node development mode, but can be run directly in cmd, such as using npm to install express globally:

C:\Users\Neo>npm install -g express

 

After installing npm, you can install other desired nodejs modules, such as installing express command line input:

npm install express -g 

Where -g means global installation, you can not, it will be installed in the current folder, only the current project. After the global installation is complete, there will be npm in the module folder under the nodejs installation directory

npm installation graphic tutorial

 

You can use the npm command to install express, npm install express

 

 

Rookie tutorial link:

http://www.runoob.com/nodejs/nodejs-npm.html

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326311205&siteId=291194637