Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

node.js

npm

I am new to node.js. I downloaded and install node.js installer from the official site. I have added this installer folder in PATH environment variable and I am able to run programs. But when I try to install some package using npm in node console it shows the error npm should be run outside of the node repl, in your normal shell. I also tried it on a separate console. But it shows command not found though I have added node in the environment variable.

enter image description here

enter image description here

like image 278
Aniket Thakur Avatar asked Jun 29 '14 14:06

Aniket Thakur


People also ask

How do I get out of node REPL?

To exit from the REPL terminal, press Ctrl + C twice or write . exit and press Enter.

How do I resolve NPM start error?

To solve the npm ERR! Missing script: "start" error, make sure to add a start command to the scripts object in your package. json file and open your shell or IDE in the root directory of your project before running the npm start command.

Which command is used to run REPL session in node?

Run REPL from JavaScript file We can import the REPL in a JavaScript file using repl . repl. start(); Run the file in the command line.

How do I exit a run in NPM?

To stop a running npm process, press CTRL + C or close the shell window.


2 Answers

For Windows users, run npm commands from the Command Prompt (cmd.exe), not Node.Js (node.exe). So your "normal shell" is cmd.exe. (I agree this message can be confusing for a Windows, Node newbie.)

By the way, the Node.js Command Prompt is actually just an easy shortcut to cmd.exe.

Below is an example screenshot for installing grunt from cmd.exe:

enter image description here

like image 152
James Lawruk Avatar answered Oct 13 '22 00:10

James Lawruk


Do not run the application using node.js icon.

Go to All Programmes->Node.js->Node.js command prompt.

Below is example screen shot.

enter image description here

enter image description here

like image 27
Aman Avatar answered Oct 12 '22 23:10

Aman