标签:
今天在使用 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 构建工具,创建的默认页面。
标签:
原文地址:http://www.cnblogs.com/ayseeing/p/4419447.html