我安裝使用,一飲而盡npm install -g gulp
爲什麼在全球安裝時不運行gulp?
[npm WARN deprecation warnings redacted]
/usr/local/bin/gulp -> /usr/local/lib/node_modules/gulp/bin/gulp.js
/usr/local/lib
└── [email protected]
當我嘗試運行吞氣命令我得到:
gulp
[19:42:23] Local gulp not found in ~/javascript
[19:42:23] Try running: npm install gulp
但是,當我在全球安裝另一個NPM包,它的工作原理。例如,當我安裝create-react-app
像這樣:
npm install -g create-react-app
/usr/local/bin/create-react-app -> /usr/local/lib/node_modules/create-react-app/index.js
/usr/local/lib
└─┬ [email protected]
├─┬ [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├─┬ [email protected]
│ │ └── [email protected]
│ ├── [email protected]
│ └── [email protected]
├─┬ [email protected]
│ ├─┬ [email protected]
│ │ ├── [email protected]
│ │ └── [email protected]
│ └─┬ [email protected]
│ └── [email protected]
├── [email protected]
└── [email protected]
當我運行安裝後,它的工作原理命令:
create-react-app
Usage: create-react-app <project-directory> [--verbose]
有什麼理由會吞掉旋出?
哪裏是位於'npm'倉?輸入'npm bin -g',當你得到輸出時,試着直接從該路徑運行命令,例如在我的筆記本電腦上就是它的位置:'/ home/kyle/.linuxbrew/bin'。所以我可以運行'/ home/kyle/.linuxbrew/bin/gulp',它會運行。如果你沒有看到這個命令,這可能意味着你在'$ PATH'變量中沒有這個路徑設置,所以你需要編輯'.bash_profile'(或者如果你把它放在其他地方或使用Zsh或其他shell)。 –
npm bin路徑在我的$ PATH – Simpleton
可能重複[爲什麼我們需要在全局和本地安裝gulp?](http://stackoverflow.com/questions/22115400/why-do-we-need-to- install-gulp-worldwide-and-locally) –