node.js - yo angular提示Cannot find module 'yeoman-generator'
迷茫
迷茫 2017-04-17 13:45:31
0
2
572

忘记了用npm进行过什么操作了,当再次创建一个文件夹,并在里面执行yo angular时提示如下:

Out of the box I include Bootstrap and some AngularJS recommended modules.

? Would you like to use Sass (with Compass)? Yes
? Would you like to include Bootstrap? Yes
? Would you like to use the Sass version of Bootstrap? Yes
? Which modules would you like to include? angular-animate.js, angular-cookies.js, angular
-resource.js, angular-route.js, angular-sanitize.js, angular-touch.js
   create app/styles/main.scss
   create app/index.html
   create bower.json
identical .bowerrc
   create package.json
   create Gruntfile.js
   create README.md
   invoke   angular:common:/Users/Kavlez/node_modules/generator-angular/app/index.js
identical     .editorconfig
identical     .gitattributes
identical     .jshintrc
identical     .yo-rc.json
identical     .gitignore
   create     test/.jshintrc
   create     app/.buildignore
   create     app/.htaccess
   create     app/404.html
   create     app/favicon.ico
   create     app/robots.txt
   create     app/views/main.html
   create     app/images/yeoman.png
   invoke   angular:main:/Users/Kavlez/node_modules/generator-angular/app/index.js
   create     app/scripts/app.js
   invoke   angular:controller:/Users/Kavlez/node_modules/generator-angular/app/index.js
   create     app/scripts/controllers/main.js
   create     test/spec/controllers/main.js
module.js:338
    throw err;
    ^
Error: Cannot find module 'yeoman-generator'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:278:25)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (/Users/Kavlez/.npm-packages/lib/node_modules/generator-karma/generators/app/index.js:3:18)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)

有人遇到过类似情况吗? 到底是哪里出了问题?

迷茫
迷茫

业精于勤,荒于嬉;行成于思,毁于随。

全員に返信(2)
刘奇

解决方法:

npm i -g -d yeoman-generator
いいねを押す +0
阿神

依赖包没安装吧 npm i -d 试试?

いいねを押す +0
人気のチュートリアル
詳細>
最新のダウンロード
詳細>
ウェブエフェクト
公式サイト
サイト素材
フロントエンドテンプレート