【问题标题】:How to correctly install Yeoman in Ubuntu 12.04?如何在 Ubuntu 12.04 中正确安装 Yeoman?
【发布时间】:2014-04-09 14:55:38
【问题描述】:

为了简化与前端相关的工作流程,我尝试使用 Yeoman 生成一个包含常用包的空白项目,特别是 Bootstrap 3 的 SASS 风格。我在 Ubuntu 12.04 上运行。

我首先通过apt-get install git 安装了Git,然后成功安装了Yeoman。之后,我在 localhost 上转到了我的应用程序目录

cd /var/www/prototype

为了执行设置

/var/www/prototype$ yo webapp.

然后开始安装,但是,我收到了几条错误消息:

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

Out of the box I include HTML5 Boilerplate, jQuery, and a Gruntfile.js to build your app.

[?] What more would you like? Bootstrap, Sass
[?] Would you like to use libsass? Read up more at 
[?] Would you like to use libsass? Read up more at 

https://github.com/andrew/node-sass#reporting-sass-compilation-and-syntax-issues: Yes

   create Gruntfile.js
   create package.json
identical .gitignore
identical .gitattributes
   create bower.json
identical .jshintrc
identical .editorconfig
   create app/favicon.ico
   create app/404.html
   create app/robots.txt
   create app/.htaccess
   create app/styles/main.scss
   create app/index.html
   create app/scripts/main.js


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


npm WARN package.json prototype@0.0.0 No description
npm WARN package.json prototype@0.0.0 No repository field.
npm WARN package.json prototype@0.0.0 No README data
npm http GET https://registry.npmjs.org/grunt-contrib-copy
npm http GET https://registry.npmjs.org/grunt-sass
npm http GET https://registry.npmjs.org/grunt-contrib-concat
npm http GET https://registry.npmjs.org/grunt-contrib-jshint
npm http GET https://registry.npmjs.org/grunt-contrib-uglify
npm http GET https://registry.npmjs.org/grunt-contrib-cssmin
npm http GET https://registry.npmjs.org/grunt-contrib-connect
npm http GET https://registry.npmjs.org/grunt-contrib-clean
npm http GET https://registry.npmjs.org/grunt-bower-install
npm http GET https://registry.npmjs.org/grunt-contrib-imagemin
npm http GET https://registry.npmjs.org/grunt-contrib-watch
npm http GET https://registry.npmjs.org/grunt-rev
npm http GET https://registry.npmjs.org/grunt-autoprefixer
npm http GET https://registry.npmjs.org/grunt-usemin
npm http GET https://registry.npmjs.org/grunt-mocha
npm http GET https://registry.npmjs.org/grunt-newer
npm http GET https://registry.npmjs.org/grunt-svgmin
npm http GET https://registry.npmjs.org/grunt-concurrent
npm http GET https://registry.npmjs.org/load-grunt-tasks
npm http GET https://registry.npmjs.org/time-grunt
npm http GET https://registry.npmjs.org/jshint-stylish
npm http GET https://registry.npmjs.org/grunt
npm http GET https://registry.npmjs.org/grunt-contrib-htmlmin
bower not-cached    git://github.com/jquery/jquery.git#~1.11.0
bower resolve       git://github.com/jquery/jquery.git#~1.11.0
bower not-cached    git://github.com/twbs/bootstrap-sass.git#~3.1.0
bower resolve       git://github.com/twbs/bootstrap-sass.git#~3.1.0
npm http 304 https://registry.npmjs.org/grunt-contrib-concat
npm http 304 https://registry.npmjs.org/grunt-contrib-uglify
npm ERR! Error: EACCES, mkdir '/home/user/tmp/npm-2136-88_Zw0-I'
npm ERR!  { [Error: EACCES, mkdir '/home/user/tmp/npm-2136-88_Zw0-I']
npm ERR!   errno: 3,
npm ERR!   code: 'EACCES',
npm ERR!   path: '/home/user/tmp/npm-2136-88_Zw0-I',
npm ERR!   parent: 'prototype' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

npm ERR! System Linux 3.8.0-38-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install"
npm ERR! cwd /var/www/prototype
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.4.3
npm ERR! path /home/user/tmp/npm-2136-88_Zw0-I
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, mkdir '/home/user/tmp/npm-2136-88_Zw0-I'
npm http 304 https://registry.npmjs.org/grunt-sass
npm http 304 https://registry.npmjs.org/grunt-contrib-copy
npm http 304 https://registry.npmjs.org/grunt-contrib-cssmin
npm http 304 https://registry.npmjs.org/grunt-contrib-jshint
npm http 304 https://registry.npmjs.org/grunt-contrib-clean
npm http 304 https://registry.npmjs.org/grunt-contrib-connect
npm http 304 https://registry.npmjs.org/grunt-bower-install
npm http 304 https://registry.npmjs.org/grunt-contrib-imagemin
npm http 304 https://registry.npmjs.org/grunt-autoprefixer
npm http 304 https://registry.npmjs.org/grunt-rev
npm http 304 https://registry.npmjs.org/grunt-contrib-watch
npm http 304 https://registry.npmjs.org/grunt-mocha
npm http 304 https://registry.npmjs.org/grunt-usemin
npm http 304 https://registry.npmjs.org/grunt-newer
npm http 304 https://registry.npmjs.org/grunt-svgmin
npm http 304 https://registry.npmjs.org/time-grunt
npm http 304 https://registry.npmjs.org/load-grunt-tasks
npm http 200 https://registry.npmjs.org/grunt-concurrent
npm http 304 https://registry.npmjs.org/jshint-stylish
npm http 304 https://registry.npmjs.org/grunt
npm http 304 https://registry.npmjs.org/grunt-contrib-htmlmin
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /var/www/prototype/npm-debug.log
npm ERR! not ok code 0

events.js:74
        throw TypeError('Uncaught, unspecified "error" event.');
              ^
TypeError: Uncaught, unspecified "error" event.
    at TypeError (<anonymous>)
    at Appgenerator.EventEmitter.emit (events.js:74:15)
    at done (/usr/lib/node_modules/generator-webapp/node_modules/yeoman-generator/lib/base.js:318:16)
    at /usr/lib/node_modules/generator-webapp/node_modules/yeoman-generator/node_modules/async/lib/async.js:232:13
    at /usr/lib/node_modules/generator-webapp/node_modules/yeoman-generator/node_modules/async/lib/async.js:113:21
    at /usr/lib/node_modules/generator-webapp/node_modules/yeoman-generator/node_modules/async/lib/async.js:24:16
    at /usr/lib/node_modules/generator-webapp/node_modules/yeoman-generator/node_modules/async/lib/async.js:229:17
    at /usr/lib/node_modules/generator-webapp/node_modules/yeoman-generator/node_modules/async/lib/async.js:516:34
    at Appgenerator.<anonymous> (/usr/lib/node_modules/generator-webapp/node_modules/yeoman-generator/lib/actions/install.js:43:7)
    at ChildProcess.EventEmitter.emit (events.js:117:20)
user@L512:/var/www/prototype$ bower ECMDERR       Failed to execute "git ls-remote --tags --heads git://github.com/jquery/jquery.git", exit code of #128

Additional error details:
fatal: unable to connect to github.com

Bower 似乎无法引入 jquery.git#~1.11.0 和 bootstrap-sass.git#~3.1.0。在我的本地主机上正确设置了文件夹结构,但缺少相关的 Javascript 和 Bootstrap 文件。

非常感谢您提出如何解决此问题的建议。

【问题讨论】:

    标签: git twitter-bootstrap github yeoman bower


    【解决方案1】:

    关于 Bower 部分,这既不是代理问题,也不是防火墙问题。相反,Git 需要强制使用 https:// 和以下内容:

    git config --global url."https://".insteadOf git://
    

    此外,npm 没有执行,因为它需要 Ubuntu 中的 sudo 权限,可以通过分配主目录的正确权限来修复:

    sudo chown -R <username> ~/*
    sudo chgrp -R <username> ~/*
    

    【讨论】:

      猜你喜欢
      • 2012-12-15
      • 2013-04-19
      • 2012-11-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-05-05
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多