grunt serve Warning: Running "sass:server" (sass) task

使用grunt serve运行时遇到一问题:

y@y:ydkt$ grunt serve

Running "serve" task



Running "clean:server" (clean) task

Cleaning .tmp...OK



Running "env:all" (env) task



Running "injector:sass" (injector) task

Missing option `template`, using `dest` as template instead

Injecting scss files (18 files)

>> Nothing changed



Running "concurrent:server" (concurrent) task

    Warning: Running "sass:server" (sass) task

    Warning: 

    You need to have Ruby and Sass installed and in your PATH for this task to work.

    More info: https://github.com/gruntjs/grunt-contrib-sass

     Use --force to continue.

    

    Aborted due to warnings.

    

    

    Execution Time (2015-05-30 00:44:34 UTC)

    loading tasks  209ms  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 96%

    sass:server      8ms  ▇▇ 4%

    Total 218ms Use --force to continue.

        

        Aborted due to warnings.

    



Execution Time (2015-05-30 00:44:33 UTC)

loading tasks      114ms  ▇▇▇▇▇▇▇▇▇▇ 12%

serve               22ms  ▇▇ 2%

clean:server        92ms  ▇▇▇▇▇▇▇▇ 10%

injector:sass       94ms  ▇▇▇▇▇▇▇▇ 10%

concurrent:server  602ms  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 64%

Total 934ms

问题是:提示我Ruby 与Sass未进行安装配置:

Warning: Running "sass:server" (sass) task

    Warning: 

    You need to have Ruby and Sass installed and in your PATH for this task to work.

    More info: https://github.com/gruntjs/grunt-contrib-sass

     Use --force to continue.

我 ruby -v 查看了以下ruby 版本为1.9.1 ubuntu已经进行预装了,查看了以下需要安装compass才可以编译sass.

下面进行安装compass:

y@y:ydkt$ sudo gem install compass

Fetching: sass-3.4.14.gem (100%)

Fetching: multi_json-1.11.0.gem (100%)

Fetching: compass-core-1.0.3.gem (100%)

Fetching: compass-import-once-1.0.5.gem (100%)

Fetching: chunky_png-1.3.4.gem (100%)

Fetching: rb-fsevent-0.9.5.gem (100%)

Fetching: ffi-1.9.8.gem (100%)

Building native extensions.  This could take a while...

ERROR:  Error installing compass:

        ERROR: Failed to build gem native extension.



        /usr/bin/ruby1.9.1 extconf.rb

/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError)

        from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'

        from extconf.rb:4:in `<main>'





Gem files will remain installed in /var/lib/gems/1.9.1/gems/ffi-1.9.8 for inspection.

Results logged to /var/lib/gems/1.9.1/gems/ffi-1.9.8/ext/ffi_c/gem_make.out

提示我ruby 版本过低,

Gem files will remain installed in /var/lib/gems/1.9.1/gems/ffi-1.9.8 for inspection

下一步要更新我的ruby 版本,安装2.1.2

sudo apt-get -y update

sudo apt-get install cmake



sudo apt-get install -y build-essential zlib1g-dev libyaml-dev libssl-dev libgdbm-dev libreadline-dev

   libncurses5-dev libffi-dev curl git-core openssh-server redis-server postfix checkinstall libxml2-dev 

  libxslt-dev libcurl4-openssl-dev libicu-dev mysql-client libmysqlclient-dev libreadline6-dev





curl --progress http://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.2.tar.gz | tar xz

cd ruby-2.1.2

./configure

make

sudo make install

安装成功:

y@y:~$ ruby -v

ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-linux]

y@y:~$ 

再次重新安装compass:

y@y:ydkt$ sudo gem install compass                                                                                

[sudo] password for y: 

Fetching: sass-3.4.14.gem (100%)

Successfully installed sass-3.4.14

Fetching: multi_json-1.11.0.gem (100%)

Successfully installed multi_json-1.11.0

Fetching: compass-core-1.0.3.gem (100%)

Successfully installed compass-core-1.0.3

Fetching: compass-import-once-1.0.5.gem (100%)

Successfully installed compass-import-once-1.0.5

Fetching: chunky_png-1.3.4.gem (100%)

Successfully installed chunky_png-1.3.4

Fetching: rb-fsevent-0.9.5.gem (100%)

Successfully installed rb-fsevent-0.9.5

Fetching: ffi-1.9.8.gem (100%)

Building native extensions.  This could take a while...

Successfully installed ffi-1.9.8

Fetching: rb-inotify-0.9.5.gem (100%)

Successfully installed rb-inotify-0.9.5

Fetching: compass-1.0.3.gem (100%)

    Compass is charityware. If you love it, please donate on our behalf at http://umdf.org/compass Thanks!

Successfully installed compass-1.0.3

Parsing documentation for chunky_png-1.3.4

Installing ri documentation for chunky_png-1.3.4

Parsing documentation for compass-1.0.3

Installing ri documentation for compass-1.0.3

Parsing documentation for compass-core-1.0.3

Installing ri documentation for compass-core-1.0.3

Parsing documentation for compass-import-once-1.0.5

Installing ri documentation for compass-import-once-1.0.5

Parsing documentation for ffi-1.9.8

Installing ri documentation for ffi-1.9.8

Parsing documentation for multi_json-1.11.0

Installing ri documentation for multi_json-1.11.0

Parsing documentation for rb-fsevent-0.9.5

Installing ri documentation for rb-fsevent-0.9.5

Parsing documentation for rb-inotify-0.9.5

Installing ri documentation for rb-inotify-0.9.5

Parsing documentation for sass-3.4.14

Installing ri documentation for sass-3.4.14

Done installing documentation for chunky_png, compass, compass-core, compass-import-once, ffi, multi_json, rb-fsevent, rb-inotify, sass after 7 seconds

9 gems installed

此时执行grunt serve,之前的错误已经没有了,但是又出现了新的错误:

Running "open:server" (open) task

Warning: Command failed: /bin/sh -c /home/y/my_git/ydkt/node_modules/open/vendor/xdg-open "http://localhost:9000"

/bin/sh: 1: /home/y/my_git/ydkt/node_modules/open/vendor/xdg-open: Permission denied

 Use --force to continue.



Aborted due to warnings.

提示:拒绝访问!修改文件权限:

y@y:open$ cd vendor/

y@y:vendor$ chmod 777 xdg-open 

y@y:vendor$ ll

总用量 28

drwxrwxr-x 2 y y  4096  5月 30 09:31 ./

drwxrwxr-x 4 y y  4096  5月 11 15:28 ../

-rwxrwxrwx 1 y y 19086  5月 11 15:28 xdg-open*

y@y:vendor$ 

最后执行grunt serve成功!!!

 

你可能感兴趣的:(server)