Warning: Running “compass:server” (compass) task

2019-04-17 20:22发布

D:\Projects\mallspk>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.bat' is not recognized as an internal or exter
nal command,
    operable program or batch file.
     Use --force to continue.

I have install the Yo angular and runs the followings commands:

npm install grunt --save-dev
npm install -g grunt-contrib-compass 
npm install -g compass
npm install
bower install
npm install  grunt-google-cdn

and when i run the command grunt serve i have got this error. i have latest node and npm install with latest grunt and yo.

8条回答
爷的心禁止访问
2楼-- · 2019-04-17 20:46

I searched and searched ... until finally I got the answer to this problem.
In my case it happened when I was creating a new angularjs application with yeomen.

This answer is specific to windows users

Step 1: Install ruby http://rubyinstaller.org/downloads/

Step 2 : download rubygems Link : https://rubygems.org/rubygems/rubygems-2.6.8.zip

Step 3 : unzip rubygems-2.6.8.zip

Step 4 : open powershell (terminal/command line) to the rubygems-2.6.8 folder path.(location of the folder eg. c:\folder\folder)

Step 5 : in the powershell terminal run these commands

> ruby setup.rb

> gem install compass

enjoy!

查看更多
戒情不戒烟
3楼-- · 2019-04-17 20:48

I have those problems too, I found a temporary fix by setting the source maps to false.

server: {
        options: {
          sourcemap: false <--
        }
      }

after that, it works like charm.

查看更多
在下西门庆
4楼-- · 2019-04-17 20:51

If you have the same strange feeling about Ruby when using node+express+Angluar, run "yo angular xyz", but use gulp instead of grunt.

查看更多
SAY GOODBYE
5楼-- · 2019-04-17 20:58

I had the same problem I installed compass gem on my desktop and it is resolved.

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

For windows you can download ruby and then install compass.

Hope it helps :)

查看更多
Juvenile、少年°
6楼-- · 2019-04-17 20:59

I've the same problem in ubuntu and I did this to solve my problem :

  1. sudo apt-get install ruby
  2. sudo apt-get install ruby-compass
  3. sudo gem install compass

after that grunt serve works

查看更多
The star\"
7楼-- · 2019-04-17 21:07

From the document of grunt-contrib-compass, that says:

"This task requires you to have Ruby, Sass, and Compass >=1.0.1 installed" and "When you've confirmed you have Ruby installed, run gem update --system && gem install compass to install Compass and Sass."

I followed this instruction and fixed the warning.

查看更多
登录 后发表回答