"Fatal error: Unable to find local grunt." on windows7 professional

f I want to run 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
grunt-cli@0.1.13 C:\Users\dev_user\AppData\Roaming\npm\node_modules\grunt-cli
+-- nopt@1.0.10 (abbrev@1.0.7)
+-- resolve@0.3.1
+-- findup-sync@0.1.3 (lodash@2.4.2, glob@3.2.11)

      

Putting grunt into the 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 this same message appears 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
+-- coffee-script@1.9.3
+-- grunt-cli@0.1.13
  +-- findup-sync@0.1.3
  ¦ +-- glob@3.2.11
  ¦ ¦ +-- inherits@2.0.1
  ¦ ¦ +-- minimatch@0.3.0
  ¦ ¦   +-- lru-cache@2.6.5
  ¦ ¦   +-- sigmund@1.0.1
  ¦ +-- lodash@2.4.2
  +-- nopt@1.0.10
  ¦ +-- abbrev@1.0.7
  +-- resolve@0.3.1

      

Environment variable I set:

Variable name: grunt Path: C:\Users\dev_user\AppData\Roaming\npm\grunt

then started a new computer

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

+3


source to share


2 answers


Installation grunt-cli

does not install the Grunt task runner. grunt-cli

is a command line interface that allows you to install multiple versions of Grunt at the same time on the same computer.

To install grunt

, you need to install it globally using the following command:

npm install -g grunt

      

or locally with the following command:



npm install grunt

      

You read about cold text grunt-cli

in the official doc

Note from @Matthew Bakaitis:

Installing grunt globally is not recommended

Good practice as grunt-cli downloads the global version first (if I remember). If the project was expecting a specific version of the grunt, a global install would break that. Also, if you depend on nagging for your compilations, why don't you install it as a dependency and list it in package.json? There's a huge assumption that other developers or target system will have grunt installed globally unless you add 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.

+5


source


Solution to my problem. In my case, I have a coworker who found a solution. I have installed two versions of NodeJS, the older version 1.0.35 and the current version 1.2.7. Only one version was visible in the Windows uninstaller! After I removed this version and all directories, that is, the old version and the new version were removed after the current version was installed, because I could have run npm install . After that I can easily grumble, it works correctly.



+1


source







All Articles