Lokesh
Lokesh

Reputation: 514

node npm command closed command prompt immediately

I installed node using installer on windows 10 When I run the following command, the version is returned normally.

node -v
v14.15.3

but when I any npm command, the command prompt closes immediately.

npm -v

Upvotes: 0

Views: 1116

Answers (1)

Mr.
Mr.

Reputation: 10102

from your short post, it feels to me that your shell is configured to exit when error occurs

for instance, if you are using bash, then you have the set command. if you use set -e

When this option is on, when any command fails the shell immediately shall exit

i guess that you shell is closing since npm -v returns non-zero exit code.

so depending on your environment\shell, will advise you to check whether set -e is set and whether npm in installed.

Upvotes: 1

Related Questions