admin管理员组

文章数量:1310450

f I want to start grunt, I get the following message:

c:\repositories\kunde_1\themes-projekt_1\projekt_1-responsive\source>grunt
grunt-cli: The grunt mand 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:


When running grunt you will see:

C:\Users\dev_user>npm install -g grunt-cli
npm http GET 
npm http 304 
npm http GET 
npm http GET 
npm http GET 
npm http 304 
npm http 304 
npm http 304 
npm http GET 
npm http GET 
npm http GET 
npm http 304 
npm http 304 
npm http 304 
npm http GET 
npm http GET 
npm http 304 
npm http 304 
npm http GET 
npm http GET 
npm http 304 
npm http 304 
C:\Users\dev_user\AppData\Roaming\npm\grunt -> C:\Users\dev_user\AppData\Roaming\npm\node_modules\grunt-cli\bin\grunt
[email protected] C:\Users\dev_user\AppData\Roaming\npm\node_modules\grunt-cli
+-- [email protected] ([email protected])
+-- [email protected]
+-- [email protected] ([email protected], [email protected])

Entering grunt in user directory:

C:\Users\dev_user>grunt
grunt-cli: The grunt mand 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:


But the same message es when I enter the project directory!

operating system: windows 7 Professional
npm -version: 1.3.5
node --version: v0.10.15

C:\Users\dev_user>npm ls -g
C:\Users\dev_user\AppData\Roaming\npm
+-- [email protected]
+-- [email protected]
  +-- [email protected]
  ¦ +-- [email protected]
  ¦ ¦ +-- [email protected]
  ¦ ¦ +-- [email protected]
  ¦ ¦   +-- [email protected]
  ¦ ¦   +-- [email protected]
  ¦ +-- [email protected]
  +-- [email protected]
  ¦ +-- [email protected]
  +-- [email protected]

The environment variable I have set:

Name of variable: grunt Path: C:\Users\dev_user\AppData\Roaming\npm\grunt then launched new puter

Does anyone have an idea why the message Fatal error: Unable to find local grunt. ing?

f I want to start grunt, I get the following message:

c:\repositories\kunde_1\themes-projekt_1\projekt_1-responsive\source>grunt
grunt-cli: The grunt mand 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./getting-started

When running grunt you will see:

C:\Users\dev_user>npm install -g grunt-cli
npm http GET https://registry.npmjs/grunt-cli
npm http 304 https://registry.npmjs/grunt-cli
npm http GET https://registry.npmjs/nopt
npm http GET https://registry.npmjs/findup-sync
npm http GET https://registry.npmjs/resolve
npm http 304 https://registry.npmjs/nopt
npm http 304 https://registry.npmjs/findup-sync
npm http 304 https://registry.npmjs/resolve
npm http GET https://registry.npmjs/abbrev
npm http GET https://registry.npmjs/glob
npm http GET https://registry.npmjs/lodash
npm http 304 https://registry.npmjs/abbrev
npm http 304 https://registry.npmjs/glob
npm http 304 https://registry.npmjs/lodash
npm http GET https://registry.npmjs/inherits
npm http GET https://registry.npmjs/minimatch
npm http 304 https://registry.npmjs/inherits
npm http 304 https://registry.npmjs/minimatch
npm http GET https://registry.npmjs/lru-cache
npm http GET https://registry.npmjs/sigmund
npm http 304 https://registry.npmjs/lru-cache
npm http 304 https://registry.npmjs/sigmund
C:\Users\dev_user\AppData\Roaming\npm\grunt -> C:\Users\dev_user\AppData\Roaming\npm\node_modules\grunt-cli\bin\grunt
[email protected] C:\Users\dev_user\AppData\Roaming\npm\node_modules\grunt-cli
+-- [email protected] ([email protected])
+-- [email protected]
+-- [email protected] ([email protected], [email protected])

Entering grunt in user directory:

C:\Users\dev_user>grunt
grunt-cli: The grunt mand 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./getting-started

But the same message es when I enter the project directory!

operating system: windows 7 Professional
npm -version: 1.3.5
node --version: v0.10.15

C:\Users\dev_user>npm ls -g
C:\Users\dev_user\AppData\Roaming\npm
+-- [email protected]
+-- [email protected]
  +-- [email protected]
  ¦ +-- [email protected]
  ¦ ¦ +-- [email protected]
  ¦ ¦ +-- [email protected]
  ¦ ¦   +-- [email protected]
  ¦ ¦   +-- [email protected]
  ¦ +-- [email protected]
  +-- [email protected]
  ¦ +-- [email protected]
  +-- [email protected]

The environment variable I have set:

Name of variable: grunt Path: C:\Users\dev_user\AppData\Roaming\npm\grunt then launched new puter

Does anyone have an idea why the message Fatal error: Unable to find local grunt. ing?

Share Improve this question asked Aug 4, 2015 at 12:42 webuser57webuser57 1711 gold badge2 silver badges9 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 5

Installing grunt-cli does not install the Grunt task runner. grunt-cli is Command line interface that allows multiple versions of Grunt to be installed on the same machine simultaneously.

To install grunt you need to install it globally by the following mand:

npm install -g grunt

or locally by the following mand:

npm install grunt

You cold read about grunt-cli in official doc

Note from @Matthew Bakaitis:

Installing grunt globally is discouraged

It's good practice as grunt-cli loads a global version first (if I recall). If a project was expecting a specific version of grunt, installing globally would break this. Also, if you are depending upon grunt for your builds, why wouldn't you install it as a dependency and list it in package.json? There's a huge assumption that other developers or the target system will have grunt installed globally if you aren't adding as a dependency in package.json. Given the usage situations for grunt, I can't think of many situations where a global install would be better.

The solution to my problem. In my case I have a co-worker found the solution. I had installed two version of NodeJS, an older 1.0.35 and the current 1.2.7 version. In Windows uninstaller only one version was visible! After I have uninstalled that version and all directories, that is, the old version and the new version was deleted after the current version was contradicted installed, because I could mand should npm install call. After that, I can grunt call easily, it is working properly.

本文标签: javascriptquotFatal error Unable to find local gruntquot on windows7 professionalStack Overflow