node.js Grunt 需要在系统路径中安装指南针警告

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21865609/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-02 16:52:35  来源:igfitidea点击:

Grunt need compass installed in system PATH Warning

eclipsenode.jsgruntjsyeomanbower

提问by Eric

I want to install Yeoman, Grunt and bower to my node project.

我想将 Yeoman、Grunt 和 bower 安装到我的节点项目中。

I made a node project in Eclipse (using the nodeclipse plugin) and navigated to the project folder (wich is H:\Eclipse Workspace\YoTest) in cmd and typed in:

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

npm install yo -g

npm install generator-webapp -g

yo webapp

selected: Sass (with compass), in cmd

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

And then typed:

然后输入:

grunt serve

to run the webapp.

运行 web 应用程序。

I get the following error message:

我收到以下错误消息:

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.

How do I fix this so that I can run my node project with grunt?

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

PS: Im not sure if it has anything to do with the problem, but I also get the following errors on line 1-27 in my package.json:

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

Multiple markers at this line
    - strings must use singlequote
    - strings must use singlequote

This is my package.json

这是我的 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"
  }
}

I'm on Windows.

我在 Windows 上。

回答by Eric

The warning seems to say it all.

警告似乎说明了一切。

  1. If you're on OS X or Linux you probably already have Ruby installed; test with ruby -vin your terminal. When you've confirmed you have Ruby installed, run gem update --system && gem install compassto install Compass and Sass.

  2. If that doesn't help, then install the grunt-contrib-compasspackage with the instructions at https://github.com/gruntjs/grunt-contrib-compass

  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上的说明安装软件包

回答by dtc

I struggled for hours with this same error message when running a gulp watch, and despite installing, reinstalling, rebooting, it would still show up.

在运行 gulp watch 时,我为同样的错误消息苦苦挣扎了几个小时,尽管安装、重新安装、重新启动,它仍然会出现。

Got it working by uninstalling all my packages :

通过卸载我的所有软件包使其工作:

sudo gem uninstall bundler bundle compass sass compass-core compass-import-once

And installing bundle only

并且只安装包

sudo gem install bundle bundler

And then run the command that magically installed everything I needed :

然后运行神奇地安装了我需要的一切的命令:

$ bundle
Fetching gem metadata from https://rubygems.org/...........
Fetching version metadata from https://rubygems.org/..
Installing sass 3.4.9
Installing sassy-maps 0.4.0
Installing breakpoint 2.5.0
Installing hitimes 1.2.2
Installing timers 4.0.1
Installing celluloid 0.16.0
Using chunky_png 1.3.3
Using multi_json 1.10.1
Installing compass-core 1.0.1
Using compass-import-once 1.0.5
Using rb-fsevent 0.9.4
Using ffi 1.9.6
Using rb-inotify 0.9.5
Installing compass 1.0.1
Installing json 1.8.1
Installing listen 2.8.3
Installing thor 0.19.1
Installing fontcustom 1.3.7
Installing modular-scale 2.0.5
Installing normalize-scss 3.0.2
Installing sass-css-importer 1.0.0.beta.0
Installing sassy-buttons 0.2.6
Installing susy 2.1.3
Using bundler 1.8.0
Bundle complete! 9 Gemfile dependencies, 24 gems now installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.
Post-install message from compass:
    Compass is charityware. If you love it, please donate on our behalf at http://umdf.org/compass Thanks!
Post-install message from fontcustom:
>> Thanks for installing Font Custom! Please ensure that fontforge is installed before compiling any icons. Visit <http://fontcustom.com> for instructions.

Now, don't ask me why, but it all works :-)

现在,不要问我为什么,但这一切都有效:-)

Hope that can help anybody out there, I really struggled on this one ...

希望可以帮助那里的任何人,我真的在这个问题上很挣扎......

回答by Nevin Raj Victor

For Mac OS X 10.10 (Yosemite)

对于 Mac OS X 10.10(优胜美地)

Search for installed ruby version ruby -v. If present update gems using sudo gem update --systemelse install rvm with ruby using \curl -sSL https://get.rvm.io | bash -s stable --ruby

搜索已安装的 ruby​​ 版本 ruby -v。如果存在更新 gems 使用 sudo gem update --systemelse install rvm with ruby​​ using \curl -sSL https://get.rvm.io | bash -s stable --ruby

Then install the Xcode Command Line Tools xcode-select --install. This will take some time.

然后安装 Xcode Command Line Tools xcode-select --install。这将需要一些时间。

Now install compass using sudo gem install compass. For me this worked like a charm.

现在使用sudo gem install compass. 对我来说,这就像一种魅力。

回答by Anandaraja_Srinivasan

Ruby and Ruby Gems ought to be installed which in turn facilitate the installation of Sass and compass. Check this out http://hecktechsolutions.blogspot.in/2015/03/installation-of-gems-compass-and-sass.html

应该安装 Ruby 和 Ruby Gems,这反过来又促进了 Sass 和指南针的安装。看看这个http://hecktechsolutions.blogspot.in/2015/03/installation-of-gems-compass-and-sass.html

回答by htrix

Just need to write on console -> (or sudo )gem install compass ,because the npm command wouldn′t do anything

只需要在控制台上写 -> (或 sudo )gem install compass ,因为 npm 命令不会做任何事情