如何告诉grunt在本地node_modules中查找模块?

时间:2014-07-30 11:16:37

标签: ruby gruntjs npm

我尝试运行compass任务:

» grunt compass:dist
Running "compass:dist" (compass) task
rbenv: compass: command not found

The `compass' command exists in these Ruby versions:
  1.9.3-p448

Warning: 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.

指的是:

» rbenv versions
  system
  1.9.3-p448
* 2.1.0 (set by ..../app/.ruby-version)

但谁关心红宝石装置呢?我compass 在本地安装了app/node_modules模块

» npm list | head
app-settings@0.0.0 .../app
├── compass@0.1.0
├── ember-template-compiler@1.6.1
├─┬ grunt@0.4.2
│ ├── async@0.1.22
│ ├── coffee-script@1.3.3

我有几个问题:

  1. 何时从ruby安装中获取模块,何时从本地node_modules获取模块?
  2. 如何解决我的问题,并在node_modules中告诉咕噜罗盘模块确实已安装?

1 个答案:

答案 0 :(得分:4)

令全球rubygems与本地的rbenv local 2.1.0 # DO THIS FIRST: select the ruby version to use gem install compass # install the gems with the selected ruby version rbenv rehash # recompute all shims for ruby / gems rbenv versions ruby --version compass --version which ruby which compass 混淆。正确的方法是:

{{1}}

现在你可以验证:

{{1}}