最新的角度生成器在我的macbook pro上抛出了很多错误

时间:2014-07-27 01:15:44

标签: angularjs macos yeoman yeoman-generator

我刚刚得到这个macbook pro和当然安装了最新版本的角度发生器自耕农,当我运行它时,我得到了一大堆错误,我重新安装了哟和角度发生器,在我试图做之前多次! sudo yo angular

macs-mbp-2:yeoman myUser$ sudo npm install -g yo
/usr/local/bin/yo -> /usr/local/lib/node_modules/yo/cli.js

> yo@1.2.0 postinstall /usr/local/lib/node_modules/yo
> node ./scripts/doctor

[Yeoman Doctor] Everything looks alright!

npm WARN unmet dependency /usr/local/lib/node_modules/bower requires insight@'~0.3.0' but will load
npm WARN unmet dependency /usr/local/lib/node_modules/insight,
npm WARN unmet dependency which is version 0.4.0
yo@1.2.0 /usr/local/lib/node_modules/yo
├── is-root@0.1.0
├── sudo-block@0.4.0
├── fullname@0.1.1
├── opn@0.1.2
├── async@0.9.0
├── shelljs@0.3.0
├── lodash@2.4.1
├── chalk@0.4.0 (has-color@0.1.7, ansi-styles@1.0.0, strip-ansi@0.1.1)
├── yosay@0.2.1 (pad-component@0.0.1, word-wrap@0.1.3, minimist@0.0.9)
├── nopt@3.0.1 (abbrev@1.0.5)
├── findup@0.1.5 (commander@2.1.0, colors@0.6.2)
├── string-length@0.1.2 (strip-ansi@0.2.2)
├── update-notifier@0.1.10 (semver@2.3.2, request@2.39.0, configstore@0.3.1)
├── insight@0.3.1 (object-assign@0.1.2, async@0.2.10, lodash.debounce@2.4.1, request@2.27.0, inquirer@0.4.1, configstore@0.2.3)
└── yeoman-generator@0.17.1 (dargs@0.1.0, github-username@0.1.1, diff@1.0.8, class-extend@0.1.1, rimraf@2.2.8, text-table@0.2.0, mime@1.2.11, isbinaryfile@2.0.1, mkdirp@0.5.0, debug@1.0.4, grouped-queue@0.3.0, underscore.string@2.3.3, iconv-lite@0.2.11, findup-sync@0.1.3, file-utils@0.2.0, glob@4.0.4, request@2.39.0, download@0.1.18, cheerio@0.17.0, inquirer@0.5.1, gruntfile-editor@0.1.1)
macs-mbp-2:yeoman myUser$ yo angular myApp

     _-----_
    |       |    .--------------------------.
    |--(o)--|    |    Welcome to Yeoman,    |
   `---------´   |   ladies and gentlemen!  |
    ( _´U`_ )    '--------------------------'
    /___A___\    
     |  ~  |     
   __'.___.'__   
 ´   `  |° ´ Y ` 

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

[?] Would you like to use Sass (with Compass)? No
[?] Would you like to include Bootstrap? No
[?] 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.css
   create app/index.html
   create bower.json
identical .bowerrc
   create package.json
   create Gruntfile.js
   invoke   angular:common:/usr/local/lib/node_modules/generator-angular/app/index.js
identical     .editorconfig
identical     .gitattributes
identical     .jshintrc
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:/usr/local/lib/node_modules/generator-angular/app/index.js
   create     app/scripts/app.js
   invoke   angular:controller:/usr/local/lib/node_modules/generator-angular/app/index.js
   create     app/scripts/controllers/main.js
   create     test/spec/controllers/main.js
   invoke   karma:app


I'm all done. Running bower install & npm install for you to install the required dependencies. If this fails, try running the command yourself.


   invoke       angular:route
   invoke           angular:controller:/usr/local/lib/node_modules/generator-angular/route/index.js
   create             app/scripts/controllers/about.js
   create             test/spec/controllers/about.js
   invoke           angular:view:/usr/local/lib/node_modules/generator-angular/route/index.js
   create             app/views/about.html
   create     test/karma.conf.js
identical     .travis.yml

module.js:340
    throw err;
          ^
Error: Cannot find module 'handlebars'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/usr/local/lib/node_modules/bower/lib/util/template.js:3:18)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)

/usr/local/lib/node_modules/generator-angular/node_modules/wiredep/lib/detect-dependencies.js:84
  if (_.isString(componentConfigFile.main)) {
                                    ^
TypeError: Cannot read property 'main' of undefined
    at findMainFiles (/usr/local/lib/node_modules/generator-angular/node_modules/wiredep/lib/detect-dependencies.js:84:37)
    at /usr/local/lib/node_modules/generator-angular/node_modules/wiredep/lib/detect-dependencies.js:146:17
    at forOwn (/usr/local/lib/node_modules/generator-angular/node_modules/wiredep/node_modules/lodash/dist/lodash.js:1301:15)
    at Function.forEach (/usr/local/lib/node_modules/generator-angular/node_modules/wiredep/node_modules/lodash/dist/lodash.js:2595:9)
    at detectDependencies (/usr/local/lib/node_modules/generator-angular/node_modules/wiredep/lib/detect-dependencies.js:28:5)
    at wiredep (/usr/local/lib/node_modules/generator-angular/node_modules/wiredep/wiredep.js:57:39)
    at Generator._injectDependencies (/usr/local/lib/node_modules/generator-angular/app/index.js:326:5)
    at /usr/local/lib/node_modules/generator-angular/node_modules/yeoman-generator/node_modules/async/lib/async.js:232:13
    at /usr/local/lib/node_modules/generator-angular/node_modules/yeoman-generator/node_modules/async/lib/async.js:113:21
    at /usr/local/lib/node_modules/generator-angular/node_modules/yeoman-generator/node_modules/async/lib/async.js:24:16
macs-mbp-2:yeoman myUser$ npm WARN package.json myapp@0.0.0 No description
npm WARN package.json myapp@0.0.0 No repository field.
npm WARN package.json myapp@0.0.0 No README data
npm WARN package.json myapp@0.0.0 No description
npm WARN package.json myapp@0.0.0 No repository field.
npm WARN package.json myapp@0.0.0 No README data
npm WARN deprecated grunt-ngmin@0.0.3: use grunt-ng-annotate instead
npm ERR! Error: EACCES, open '/Users/myUser/.npm/lodash/2.4.1/package/package.json'
npm ERR!  { [Error: EACCES, open '/Users/myUser/.npm/lodash/2.4.1/package/package.json']
npm ERR!   errno: 3,
npm ERR!   code: 'EACCES',
npm ERR!   path: '/Users/myUser/.npm/lodash/2.4.1/package/package.json',
npm ERR!   parent: 'grunt-karma' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

npm ERR! System Darwin 13.1.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "karma-phantomjs-launcher" "karma-jasmine" "grunt-karma" "--save-dev"
npm ERR! cwd /Applications/MAMP/htdocs/yeoman
npm ERR! node -v v0.10.29
npm ERR! npm -v 1.4.14
npm ERR! path /Users/myUser/.npm/lodash/2.4.1/package/package.json
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, open '/Users/myUser/.npm/lodash/2.4.1/package/package.json'
npm ERR! Error: EACCES, open '/Users/myUser/.npm/lodash/2.4.1/package/package.json'
npm ERR!  { [Error: EACCES, open '/Users/myUser/.npm/lodash/2.4.1/package/package.json']
npm ERR!   errno: 3,
npm ERR!   code: 'EACCES',
npm ERR!   path: '/Users/myUser/.npm/lodash/2.4.1/package/package.json',
npm ERR!   parent: 'grunt-contrib-watch' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

npm ERR! System Darwin 13.1.0
npm ERR! command "node" "/usr/local/bin/npm" "install"
npm ERR! cwd /Applications/MAMP/htdocs/yeoman
npm ERR! node -v v0.10.29
npm ERR! npm -v 1.4.14
npm ERR! path /Users/myUser/.npm/lodash/2.4.1/package/package.json
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, open '/Users/myUser/.npm/lodash/2.4.1/package/package.json'
npm WARN deprecated ngmin@0.4.1: use ng-annotate instead
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /Applications/MAMP/htdocs/yeoman/npm-debug.log
npm ERR! not ok code 0
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /Applications/MAMP/htdocs/yeoman/npm-debug.log
npm ERR! not ok code 0
macs-mbp-2:yeoman myUser$ 

这不应该在mac上更容易吗?

我试过sudo yo angular app anbd我得到的就是这个。

/usr/local/lib/node_modules/generator-angular/node_modules/yeoman-generator/node_modules/mkdirp/index.js:74
                    throw err0;
                          ^
Error: EACCES, permission denied '/Applications/MAMP/htdocs/yeoman/app'
    at Object.fs.mkdirSync (fs.js:647:18)
    at sync (/usr/local/lib/node_modules/generator-angular/node_modules/yeoman-generator/node_modules/mkdirp/index.js:55:12)
    at Function.sync (/usr/local/lib/node_modules/generator-angular/node_modules/yeoman-generator/node_modules/mkdirp/index.js:61:24)
    at Generator.<anonymous> (/usr/local/lib/node_modules/generator-angular/node_modules/yeoman-generator/lib/actions/actions.js:106:12)
    at processImmediate [as _immediateCallback] (timers.js:336:15)

1 个答案:

答案 0 :(得分:6)

这是known issue。请使用

设置正确的节点写入权限
sudo chown -R `whoami` ~/.npm
sudo chown -R `whoami` /usr/local/lib/node_modules

再试一次。