zoukankan      html  css  js  c++  java
  • yeoman运行grunt serve 提示错误

    今天在使用 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插件全部安装。

    参考文档:http://stackoverflow.com/questions/18114666/grunt-fatal-error-unable-to-find-local-grunt-in-yeoman

    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是不需要的)。

    参考文档:http://stackoverflow.com/questions/21865609/grunt-need-compass-installed-in-system-path-warning 

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

    现在我再来安装 compass:

    $ gem install compass
    

      

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

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

  • 相关阅读:
    实习差不多一个月了
    多一个角度,多一分收获
    走出第一步
    .net中枚举enum的复习与实例
    瞧瞧UC浏览器对CSS样式的“关怀”
    关于cookie(基础)
    用ajax提交数据到ashx用JSON.stringify格式化参数后在服务器端取不到值?[转载至:http://q.cnblogs.com/q/34266/]
    [转载] SQL进行排序、分组、统计的10个新技巧
    css样式解决圆角等多种难解决的问题 (转载至:Lanny☆兰东才)
    让人想不通的突然button事件失灵了?(小心页面form表单嵌套)
  • 原文地址:https://www.cnblogs.com/ayseeing/p/4419447.html
Copyright © 2011-2022 走看看