Node.js 致命错误:找不到本地grunt。即使在更改bash_配置文件之后

Node.js 致命错误:找不到本地grunt。即使在更改bash_配置文件之后,node.js,gruntjs,mean-stack,mean.io,Node.js,Gruntjs,Mean Stack,Mean.io,我已经从其他帖子中找到了一些答案,但仍然得到同样的错误。我正在为我的项目使用mean.io框架,我应该在终端中使用命令grunt来运行我的服务器 grunt-版本: grunt-cli v0.1.13 .bash_简介: ESC="\033" # This is the escape sequence NO_COLOR="$ESC[0m" IRED="$ESC[1;31m" # ANSI color code for intense/bold red IGRN="$ESC[1;32m" # A

我已经从其他帖子中找到了一些答案,但仍然得到同样的错误。我正在为我的项目使用mean.io框架,我应该在终端中使用命令
grunt
来运行我的服务器

grunt-版本:

grunt-cli v0.1.13
.bash_简介:

ESC="\033" # This is the escape sequence
NO_COLOR="$ESC[0m"
IRED="$ESC[1;31m" # ANSI color code for intense/bold red
IGRN="$ESC[1;32m" # ANSI color code for intense/bold green

# From http://railstips.org/blog/archives/2009/02/02/bedazzle-your-bash-prompt-with-git-info/
# I had to change 'git-symbolic-ref' to 'git symbolic-ref'
function parse_git_branch {
  ref=$(git symbolic-ref HEAD 2> /dev/null) || return
  echo " ["${ref#refs/heads/}"]" # I wanted my branch wrapped in [], use () or <> or whatever
}

# from http://ariejan.net/2010/04/25/ruby-version-and-gemset-in-your-bash-prompt-yes-sir
function rvm_version {
  local gemset=$(echo $GEM_HOME | awk -F'@' '{print $2}')
  [ "$gemset" != "" ] && gemset="@$gemset"
  local version=$(echo $MY_RUBY_HOME | awk -F'-' '{print $2}')
  [ "$version" != "" ] && version="$version"
  local full="$version$gemset"
  [ "$full" != "" ] && echo "${full}:" # the colon at the end is a delimiter, you could use a space instead
}

#PS1="\h:\W \u\$" # For reference, here's the default OS X prompt
#export PS1="\$(rvm_version)\W \$(parse_git_branch)\$ " # Without the colors

# I had to put the \[ and \] down here, as opposed to $IRED, to avoid wrapping funkiness.
export PS1="\[$IRED\]\$(rvm_version)\[$NO_COLOR\]\W\[$IGRN\]\$(parse_git_branch)\[$NO_COLOR\] \$ "

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
export PATH=/usr/local/share/npm/bin:/Users/kelvinyu/.rvm/gems/ruby-2.0.0-p247@railstuorial_rails_4_0/bin:/Users/kelvinyu/.rvm/gems/ruby-2.0.0-p247@global/bin:/Users/kelvinyu/.rvm/rubies/ruby-2.0.0-p247/bin:/Users/kelvinyu/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/opt/sm/bin:/opt/sm/pkg/active/bin:/opt/sm/pkg/active/sbin
export PATH=/usr/local/share/npm/bin:/Users/kelvinyu/.rvm/gems/ruby-2.0.0-p247@railstuorial_rails_4_0/bin:/Users/kelvinyu/.rvm/gems/ruby-2.0.0-p247@global/bin:/Users/kelvinyu/.rvm/rubies/ruby-2.0.0-p247/bin:/Users/kelvinyu/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/opt/sm/bin:/opt/sm/pkg/active/bin:/opt/sm/pkg/active/sbin
export PATH=/usr/local/share/npm/bin:/Users/kelvinyu/.rvm/gems/ruby-2.0.0-p247@railstuorial_rails_4_0/bin:/Users/kelvinyu/.rvm/gems/ruby-2.0.0-p247@global/bin:/Users/kelvinyu/.rvm/rubies/ruby-2.0.0-p247/bin:/Users/kelvinyu/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/opt/sm/bin:/opt/sm/pkg/active/bin:/opt/sm/pkg/active/sbin
export PATH=/usr/local/share/npm/bin:/Users/kelvinyu/.rvm/gems/ruby-2.0.0-p247@railstuorial_rails_4_0/bin:/Users/kelvinyu/.rvm/gems/ruby-2.0.0-p247@global/bin:/Users/kelvinyu/.rvm/rubies/ruby-2.0.0-p247/bin:/Users/kelvinyu/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/opt/sm/bin:/opt/sm/pkg/active/bin:/opt/sm/pkg/active/sbin

export PATH=/usr/local/Cellar/node/0.10.24/bin/:$PATH
export PATH=/usr/local/lib/node_modules/grunt/bin:$PATH

您是否在项目目录中运行了
npm install
。这是否正确?因此
bower.json
格式不正确。这需要解决。“找不到本地grunt”通常意味着未运行
npm安装
,或者您正在错误的文件夹中执行命令。可能是格式错误的
bower.json
阻止了本地grunt的安装。还要注意grunt有两个部分:cli(通常是全局安装的)和本地grunt(安装到项目文件夹中)。我应该只运行
npm update
,然后运行
npm install
来修复bower吗?此外,我还使用
npm install-g grunt cli'安装了grunt cli,并使用
npm install grunt-g`安装了grunt。我是否需要在本地删除并重新安装grunt?
npm http GET https://registry.npmjs.org/grunt-contrib-watch
npm http GET https://registry.npmjs.org/grunt-contrib-jshint
npm http GET https://registry.npmjs.org/grunt-concurrent
npm http GET https://registry.npmjs.org/grunt-mocha-test
npm http 304 https://registry.npmjs.org/grunt-contrib-jshint
npm http 304 https://registry.npmjs.org/grunt-concurrent
npm http 304 https://registry.npmjs.org/grunt-contrib-watch
npm http 304 https://registry.npmjs.org/grunt-mocha-test

> mean@0.1.2 postinstall /Users/kelvinyu/fullstack/pleasetakeit
> node node_modules/bower/bin/bower install

bower                       EMALFORMED Failed to read /Users/kelvinyu/fullstack/pleasetakeit/bower.json

Additional error details:
Unexpected token }

npm ERR! mean@0.1.2 postinstall: `node node_modules/bower/bin/bower install`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the mean@0.1.2 postinstall script.
npm ERR! This is most likely a problem with the mean package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node node_modules/bower/bin/bower install
npm ERR! You can get their info via:
npm ERR!     npm owner ls mean
npm ERR! There is likely additional logging output above.
npm ERR! System Darwin 13.1.0
npm ERR! command "/usr/local/Cellar/node/0.10.24/bin/node" "/usr/local/Cellar/node/0.10.24/bin/npm" "install"
npm ERR! cwd /Users/kelvinyu/fullstack/pleasetakeit
npm ERR! node -v v0.10.24
npm ERR! npm -v 1.3.21
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     /Users/kelvinyu/fullstack/pleasetakeit/npm-debug.log
npm ERR! not ok code 0