码迷,mamicode.com
首页 > 其他好文 > 详细

yeoman运行grunt serve 提示错误

时间:2015-04-12 14:48:48      阅读:325      评论:0      收藏:0      [点我收藏+]

标签:

今天在使用 yeoman 的时候,当我运行 grunt serve 命令的时候,出现如下提示:

1、Error: Cannot find module ‘load-grunt-tasks‘

$ grunt serve
Loading "Gruntfile.js" tasks...ERROR
>> Error: Cannot find module ‘load-grunt-tasks‘
Warning: Task "serve" not found. Use --force to continue.

Aborted due to warnings.

  该错误是因为没有安装 load-grunt-tasks 插件,我们运行如下命令将,所有该项目依赖的所欲node插件,全部安装,命令如下:

# $ sudo npm install     #for mac
$ npm install

  该命令会将 package.js 中依赖的所有node插件全部安装。

 

 

2、Warning: Running "compass:server" (compass) task

$ grunt serve
Running "serve" task

Running "clean:server" (clean) task
>> 0 paths cleaned.

Running "wiredep:app" (wiredep) task

Running "wiredep:test" (wiredep) task

Running "wiredep:sass" (wiredep) task

Running "concurrent:server" (concurrent) task
    Warning: Running "compass:server" (compass) task
    Warning: Command failed: compass --version
    /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/dependency.rb:296:in `to_specs‘: Could not find ‘compass‘ (>= 0) among 45 total gem(s) (Gem::LoadError)
    	from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/dependency.rb:307:in `to_spec‘
    	from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_gem.rb:47:in `gem‘
    	from /usr/bin/compass:22:in `<main>‘
     Use --force to continue.
    
    Aborted due to warnings.
    
    
    Execution Time (2015-04-12 05:32:54 UTC)
    loading tasks    5ms  ▇▇▇ 5%
    compass:server  85ms  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 93%
    Total 91ms Use --force to continue.
        
        Aborted due to warnings.
    

Execution Time (2015-04-12 05:32:50 UTC)
wiredep:app        134ms  ▇▇▇ 4%
concurrent:server     3s  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 95%
Total 3.2s

  网上搜了一堆blog,最后发现是未安装 compass ,因为我用 yeoman 构建项目的时候,选了使用 sass ,而在yeoman中使用sass则又需要安装 compass (直接使用sass是不需要的)。

compass是基于 ruby 的,因此在安装 compass 前,你先需要确定,你的电脑已经安装了 ruby 。

现在我再来安装 compass:

$ gem install compass

  

安装好 compass 后,在运行 grunt serve 命令,就会自动打开 http://localhost:9000 。

你就会看到 yeoman 构建工具,创建的默认页面。

yeoman运行grunt serve 提示错误

标签:

原文地址:http://www.cnblogs.com/ayseeing/p/4419447.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!