Grunt需要在系统PATH警告中安装指南针

29 eclipse node.js gruntjs yeoman bower

我想在我的节点项目中安装Yeoman,Grunt和bower.

我在Eclipse中创建了一个节点项目(使用nodeclipse插件)并导航到cmd中的项目文件夹(名为H:\ Eclipse Workspace\YoTest)并输入:

npm install yo -g

npm install generator-webapp -g

yo webapp
Run Code Online (Sandbox Code Playgroud)

选中:Sass(带指南针),cmd

然后输入:

grunt serve
Run Code Online (Sandbox Code Playgroud)

运行webapp.

我收到以下错误消息:

Done, without errors.
    Warning: Running "compass:server" (compass) task
Warnin: You need to have Ruby and Compass installed and in your system PATH for
 this task to work. More info: https://github.com/gruntjs/grunt-contrib-compass
Use --force to continue.

Aborted due to warnings. Use --force to continue.

    Aborted due to warnings.
Run Code Online (Sandbox Code Playgroud)

我如何解决这个问题,以便我可以用grunt运行我的节点项目?

PS:我不确定它是否与问题有关,但我在package.json的第1-27行也遇到以下错误:

Multiple markers at this line
    - strings must use singlequote
    - strings must use singlequote
Run Code Online (Sandbox Code Playgroud)

这是我的package.json

{
  "name": "yotest2",
  "version": "0.0.0",
  "dependencies": {},
  "devDependencies": {
    "grunt": "~0.4.1",
    "grunt-contrib-copy": "~0.4.1",
    "grunt-contrib-concat": "~0.3.0",
    "grunt-contrib-uglify": "~0.2.0",
    "grunt-contrib-compass": "~0.7.0",
    "grunt-contrib-jshint": "~0.7.0",
    "grunt-contrib-cssmin": "~0.7.0",
    "grunt-contrib-connect": "~0.5.0",
    "grunt-contrib-clean": "~0.5.0",
    "grunt-contrib-htmlmin": "~0.1.3",
    "grunt-bower-install": "~0.7.0",
    "grunt-contrib-imagemin": "~0.2.0",
    "grunt-contrib-watch": "~0.5.2",
    "grunt-rev": "~0.1.0",
    "grunt-autoprefixer": "~0.5.0",
    "grunt-usemin": "~2.0.0",
    "grunt-mocha": "~0.4.0",
    "grunt-modernizr": "~0.4.0",
    "grunt-newer": "~0.6.0",
    "grunt-svgmin": "~0.2.0",
    "grunt-concurrent": "~0.4.0",
    "load-grunt-tasks": "~0.2.0",
    "time-grunt": "~0.2.0",
    "jshint-stylish": "~0.1.3"
  },
  "engines": {
    "node": ">=0.8.0"
  }
}
Run Code Online (Sandbox Code Playgroud)

我在Windows上.

小智 36

警告似乎说明了一切.

  1. 如果你在OS X或Linux上,你可能已经安装了Ruby; ruby -v在你的终端测试.当您确认已安装Ruby时,请运行gem update --system && gem install compass以安装Compass和Sass.

  2. 如果这没有grunt-contrib-compass用,请按照https://github.com/gruntjs/grunt-contrib-compass上的说明安装软件包.

  • 我在Windows上.我安装了ruby,还有Compass和Sass.我也遵循grunt-contrib-compass教程,但我仍然无法使它工作.只有我可以使它工作的方式是使用grunt serve --force ofcourse然后它不会加载css等. (6认同)