Reputation: 171
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 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
When running grunt you will see:
C:\Users\dev_user>npm install -g grunt-cli
npm http GET https://registry.npmjs.org/grunt-cli
npm http 304 https://registry.npmjs.org/grunt-cli
npm http GET https://registry.npmjs.org/nopt
npm http GET https://registry.npmjs.org/findup-sync
npm http GET https://registry.npmjs.org/resolve
npm http 304 https://registry.npmjs.org/nopt
npm http 304 https://registry.npmjs.org/findup-sync
npm http 304 https://registry.npmjs.org/resolve
npm http GET https://registry.npmjs.org/abbrev
npm http GET https://registry.npmjs.org/glob
npm http GET https://registry.npmjs.org/lodash
npm http 304 https://registry.npmjs.org/abbrev
npm http 304 https://registry.npmjs.org/glob
npm http 304 https://registry.npmjs.org/lodash
npm http GET https://registry.npmjs.org/inherits
npm http GET https://registry.npmjs.org/minimatch
npm http 304 https://registry.npmjs.org/inherits
npm http 304 https://registry.npmjs.org/minimatch
npm http GET https://registry.npmjs.org/lru-cache
npm http GET https://registry.npmjs.org/sigmund
npm http 304 https://registry.npmjs.org/lru-cache
npm http 304 https://registry.npmjs.org/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 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
But the same message comes 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 computer
Does anyone have an idea why the message Fatal error: Unable to find local grunt. coming?
Upvotes: 3
Views: 10068
Reputation: 171
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 command should npm install call. After that, I can grunt call easily, it is working properly.
Upvotes: 1
Reputation: 1003
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 command:
npm install -g grunt
or locally by the following command:
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.
Upvotes: 5