为什么找不到全局安装的npm软件包?

时间:2020-07-19 15:36:49

标签: npm gulp windows-10 yarnpkg nodemon

我已经在全球范围内安装了许多npm命令,例如带有以下命令的gulp命令行界面:

npm install -g gulp-cli

我可以看到它已安装: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

但是当我运行以下任何命令时:

gulp
nodemon
yarn

我得到找不到它们的响应:

$ gulp
bash: gulp: command not found

$ nodemon
bash: nodemon: command not found

$ yarn
bash: yarn: command not found

这突然发生了,好像我安装了某种导致这种情况的东西一样。无论我在哪个目录下,都会发生这种情况。我曾尝试卸载并重新安装,但无济于事。

我可以使用npx gulpnpx nodemon,因此我仍然可以工作,但想弄清楚为什么会发生这种情况。有谁知道可能会发生什么变化导致这种情况?

0 个答案:

没有答案