1

我尝试构建 atom.io 并且构建脚本完成且没有任何错误。但是当我尝试运行“./grunt install”时,我总是收到以下错误:

grunt-cli: The grunt command line interface. (v0.1.13)

Fatal error: Unable to find local grunt.

If you're seeing this message, either a Gruntfile wasn't found or grunt
hasn't been installed locally to your project. For more information about
installing and configuring grunt, please see the Getting Started guide:

http://gruntjs.com/getting-started

所以我按照“ http://gruntjs.com/getting-started ”上的建议尝试了以下命令:

sudo npm install grunt --save-dev

这将提供以下输出:

andreas@debian ~/atom.io $ sudo npm install grunt --save-dev
npm http GET https://registry.npmjs.org/grunt
npm http 304 https://registry.npmjs.org/grunt
npm http GET https://registry.npmjs.org/async
npm http GET https://registry.npmjs.org/coffee-script
npm http GET https://registry.npmjs.org/colors
npm http GET https://registry.npmjs.org/dateformat
npm http GET https://registry.npmjs.org/eventemitter2
npm http GET https://registry.npmjs.org/findup-sync
npm http 304 https://registry.npmjs.org/async
npm http GET https://registry.npmjs.org/glob
npm http GET https://registry.npmjs.org/hooker
npm http GET https://registry.npmjs.org/iconv-lite
npm http GET https://registry.npmjs.org/minimatch
npm http GET https://registry.npmjs.org/nopt
npm http GET https://registry.npmjs.org/rimraf
npm http GET https://registry.npmjs.org/lodash
npm http GET https://registry.npmjs.org/underscore.string
npm http GET https://registry.npmjs.org/which
npm http GET https://registry.npmjs.org/exit
npm http GET https://registry.npmjs.org/js-yaml
npm http GET https://registry.npmjs.org/getobject
npm http GET https://registry.npmjs.org/grunt-legacy-util
npm http GET https://registry.npmjs.org/grunt-legacy-log
npm http 304 https://registry.npmjs.org/findup-sync
npm http 304 https://registry.npmjs.org/glob
npm http 304 https://registry.npmjs.org/coffee-script
npm http 304 https://registry.npmjs.org/iconv-lite
npm http 304 https://registry.npmjs.org/hooker
npm http 304 https://registry.npmjs.org/colors
npm http 304 https://registry.npmjs.org/minimatch
npm http 304 https://registry.npmjs.org/nopt
npm http 304 https://registry.npmjs.org/rimraf
npm http 304 https://registry.npmjs.org/eventemitter2
npm http 304 https://registry.npmjs.org/lodash
npm http 304 https://registry.npmjs.org/underscore.string
npm http 304 https://registry.npmjs.org/which
npm http 304 https://registry.npmjs.org/exit
npm http 304 https://registry.npmjs.org/js-yaml
npm http 304 https://registry.npmjs.org/grunt-legacy-util
npm http 304 https://registry.npmjs.org/getobject
npm http 304 https://registry.npmjs.org/grunt-legacy-log
npm http 304 https://registry.npmjs.org/dateformat
npm http GET https://registry.npmjs.org/abbrev
npm http GET https://registry.npmjs.org/sigmund
npm http GET https://registry.npmjs.org/lru-cache
npm http GET https://registry.npmjs.org/graceful-fs
npm http GET https://registry.npmjs.org/inherits
npm http 304 https://registry.npmjs.org/abbrev
npm http GET https://registry.npmjs.org/inherits
npm http 304 https://registry.npmjs.org/sigmund
npm http GET https://registry.npmjs.org/argparse
npm http GET https://registry.npmjs.org/esprima
npm http 304 https://registry.npmjs.org/inherits
npm http 304 https://registry.npmjs.org/inherits
npm http 304 https://registry.npmjs.org/graceful-fs
npm http 304 https://registry.npmjs.org/esprima
npm http 304 https://registry.npmjs.org/lru-cache
npm http 304 https://registry.npmjs.org/argparse
npm http GET https://registry.npmjs.org/underscore
npm http 304 https://registry.npmjs.org/underscore
grunt@0.4.5 node_modules/grunt
├── dateformat@1.0.2-1.2.3
├── which@1.0.5
├── eventemitter2@0.4.13
├── getobject@0.1.0
├── rimraf@2.2.8
├── colors@0.6.2
├── async@0.1.22
├── hooker@0.2.3
├── grunt-legacy-util@0.2.0
├── exit@0.1.2
├── nopt@1.0.10 (abbrev@1.0.5)
├── lodash@0.9.2
├── coffee-script@1.3.3
├── underscore.string@2.2.1
├── iconv-lite@0.2.11
├── glob@3.1.21 (inherits@1.0.0, graceful-fs@1.2.3)
├── minimatch@0.2.14 (sigmund@1.0.0, lru-cache@2.5.0)
├── findup-sync@0.1.3 (lodash@2.4.1, glob@3.2.11)
├── grunt-legacy-log@0.1.1 (underscore.string@2.3.3, lodash@2.4.1)
└── js-yaml@2.0.5 (esprima@1.0.4, argparse@0.1.15)

然后我运行第二个命令:

npm install

这给了我以下输出:

andreas@debian ~/atom.io $ npm install

> atom@0.97.0 preinstall /home/andreas/atom.io
> node -e 'process.exit(0)'

Grunt 已安装:

andreas@debian ~/atom.io $ grunt --version
grunt-cli v0.1.13
grunt v0.4.5

但是错误并没有消失我已经用谷歌搜索了很多,但我找不到解决这个问题的有效解决方案。

此致

4

3 回答 3

13

我刚遇到同样的问题,npm update帮我解决了

于 2014-05-21T15:47:23.153 回答
0

为了./grunt install从脚本目录成功运行,您必须运行:

脚本/咕噜声安装

从根原子目录。

再见 :)

于 2014-06-13T17:39:18.537 回答
0

您需要在项目中运行此代码。

npm install grunt --save-dev
于 2015-12-23T19:07:19.853 回答