【问题标题】:Bower, Grunt on Ubuntu 12.04 - command not foundBower,Ubuntu 12.04 上的 Grunt - 找不到命令
【发布时间】:2014-10-10 15:46:07
【问题描述】:

我已经在我的机器上安装了 bower 和 grunt,但它都不起作用。我得到了:command not found

我在 .bash_profile 文件中放置了 bower 和 grunt 的路径,例如:
export PATH="/home/user/.node/lib/node_modules/grunt-cli/bin:$PATH"
export PATH="/home/user/.node/lib/node_modules/bower/bin:$PATH"

感觉包安装正确但是找不到。

npm 和 node 分别位于 home/user/.node 和 home/user/.npm 目录中,这是合适的地方吗?

which bower/grunt 不输出任何内容

【问题讨论】:

  • 您是否尝试在全球范围内安装它? npm install -g bower
  • @jack.the.ripper 是的,我做到了(路径:bower@1.3.12 /home/user/.node/lib/node_modules/bower)。我仍然有同样的问题。

标签: node.js gruntjs npm bower bower-install


【解决方案1】:

只需要提醒自己这一点,在新机器上设置环境。

根据http://gruntjs.com/getting-started,在给定项目上安装和使用 Grunt.js 任务运行器需要两个步骤:

  1. 您应该全局安装“grunt-cli”,即 Grunt 命令行界面。这会将grunt 命令放在您的系统路径上。这是通过运行npm install -g grunt-cli 来实现的,这可能需要根权限,具体取决于您的设置。

  2. 您应该本地正确安装 grunt 任务运行程序。这是通过运行npm install 来实现的,在将所需版本的Grunt.js 添加到项目的package.json 文件之后。这将安装项目的 package.json 中描述的特定版本的 Grunt.js,在 devDependencies 部分下。这是 nodejs 用来描述项目开发和部署依赖关系的文件。

【讨论】:

    【解决方案2】:

    我设法通过添加.bashrc 文件的路径来修复它,例如:

    PATH=$PATH:/home/user/.node/lib/node_modules/grunt-cli/bin
    PATH=$PATH:/home/user/.node/lib/node_modules/bower

    Reference

    【讨论】:

      猜你喜欢
      • 2012-09-15
      • 1970-01-01
      • 2017-01-12
      • 2015-05-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-10-01
      相关资源
      最近更新 更多