我有一個Yeoman發生器的問題。如果我運行「npm install [generator-name] -g」,它們安裝得很好。然而,當我嘗試運行「喲[generator-name] yeoman似乎無法找到生成器。如果我只是運行」喲「,它也不會列在我的其他生成器之中。我試過了一堆生成器,結果是永遠不變的。爲什麼我的Yeoman發電機安裝在錯誤的地方?
有點調查的一點我發現下載的發電機被放置在
/usr/local/lib/node_modules/
但我的其他發電機被放置在
/usr/local/lib/share/npm/lib/node_modules/
這裏以後是一個圖像它在我的機器上看起來如何http://i.imgur.com/DxWTYHb.png,我正在運行OSX案件很重要。看起來有點不對勁 - 但我無法弄清楚。
不知道這是否會有所幫助,但沖泡的醫生和$ NODE_PATH返回任何結果,而$ PATH返回:
-bash:
/usr/local/share/npm/bin:
/Users/marcus/.rvm/gems/ruby-2.0.0-p247/bin:
/Users/marcus/.rvm/gems/[email protected]/bin:
/Users/marcus/.rvm/rubies/ruby-2.0.0-p247/bin:
/Users/marcus/.rvm/bin:
/usr/bin:
/bin:
/usr/sbin:
/sbin:
/usr/local/bin:
/usr/local/git/bin: No such file or directory
UPDATE
我試了一下埃迪·蒙赫JR建議和現在我的角生成器工作正常。然而,當我安裝另一臺發電機(chrome-extension)時,他們堅持認爲它沒有安裝/找到。
當我運行LS $(NPM配置get前綴)/ lib目錄/ node_modules我得到這個:
bower generator-mocha
generator-angular grunt-cli
generator-chrome-extension npm
generator-karma yo
而且NPM列表-g回報這個(我切出了大量的通用的東西)
/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]
我奇怪的部份是,如果我跑喲--help我得到發電機
的怪列表210[?] What would you like to do?
[ ] Run the Angular generator
[ ] Run the Foundation generator
[ ] Run the H5bp generator
[X] Run the Mocha generator
[ ] Run the Webapp generator
[ ] Run the Karma generator
[ ] Update your generators
[ ] Install a generator
[ ] Find some help
[ ] Get me out of here!
你是怎麼跑[Yeoman Doctor]的?似乎無法弄清楚。 – anderssonma
我會將您的答覆標記爲答案,因爲我確信我的問題是相似的。我刪除了NPM並將Node.JS更新爲最新版本。然後我使用這個SH腳本[鏈接](https://npmjs.org/install.sh)再次安裝了NPM。該腳本找到並刪除了一些奇怪的NPM路徑,現在它又重新正常運行。乾杯! – anderssonma
要運行yeoman醫生,你需要'找到doctor.js'(和我一起,這是一個以'.../yo/scripts/doctor.js'結尾的路徑,並且只需要運行它。我運行喲是重新安裝喲之前在'rm -rf/usr/local/lib/node_modules/yo'之後用'npm cache clean'重新開始。 –