0

I have installed a number of npm commands globally such as the gulp command line interface with:

npm install -g gulp-cli

And I can see that it is installed: npm list -g --depth=0:

C:\Users\ADMIN\AppData\Roaming\npm
+-- @aws-amplify/cli@4.20.0       
+-- expo-cli@3.20.1
+-- gulp-cli@2.3.0
+-- http-server@0.12.3
+-- less@3.9.0
+-- less-watch-compiler@1.13.0    
+-- nodemon@2.0.4
+-- npm@6.14.4
+-- tsun@0.3.8
+-- typescript@3.9.5
+-- vue-cli@2.9.6
+-- windows-build-tools@5.2.2
`-- yarn@1.22.4

But when I run any of these commands:

gulp
nodemon
yarn

I get the response that they are not found:

$ gulp
bash: gulp: command not found

$ nodemon
bash: nodemon: command not found

$ yarn
bash: yarn: command not found

This happened all of a sudden, as if I installed something that caused this in some way. This occurs regardless of the directory I am in. I have tried uninstalling and reinstalling but to no avail.

I can use e.g. npx gulp and npx nodemon so I can still work, but would like to figure out why this has occurred. Does anyone have an idea what could have changed to cause this?

RobC
  • 22,977
  • 20
  • 73
  • 80
Edward Tanguay
  • 189,012
  • 314
  • 712
  • 1,047
  • 1
    I home this answers your question: [answer](https://stackoverflow.com/a/17976504/8588241) – Davud Safarov Jul 19 '20 at 16:57
  • @DavudSeferli Thanks, that answer helped me. The solution was to execute `npm config get prefix` and add the path given to my environment variables. After that all npm commands worked again. I still have no idea what happened to cause this. Interesting. – Edward Tanguay Jul 20 '20 at 08:47

0 Answers0