Unable to find local Grunt after install

799 views Asked by At

When I run grunt or grunt -v, I get an error:

grunt-cli: The grunt command line interface (v1.2.0)

Fatal error: Unable to find local grunt.

If you're seeing this message, 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

I am in the project root directory and have tried to install grunt locally, globally, and without a flag (I am a beginner using npm)

npm install -g grunt

npm install grunt

npm install grunt --save-dev

I have also run npm install several times after installing new/old packages.

Here are my package.json dependencies:

"dependencies": {
    "@webcomponents/webcomponentsjs": "^2.1.0",
    "babel-plugin-transform-es2015-modules-amd": "^6.24.1",
    "babel-preset-es2015": "^6.24.1",
    "babelify": "^8.0.0",
    "browserify": "^16.2.2",
    "npm-check-updates": "^2.14.2",
    "requirejs": "^2.3.6",
    "rollup-plugin-node-resolve": "^3.3.0"
  },
  "devDependencies": {
    "autoprefixer": "^9.1.3",
    "babel": "^6.23.0",
    "babel-cli": "^6.26.0",
    "babel-preset-env": "^1.7.0",
    "cssnext": "^1.8.4",
    "grunt": "^1.0.3",
    "grunt-babel": "^7.0.0",
    "grunt-browserify": "^5.3.0",
    "grunt-concurrent": "^2.3.1",
    "grunt-contrib-copy": "^1.0.0",
    "grunt-contrib-csslint": "^2.0.0",
    "grunt-contrib-jshint": "^1.1.0",
    "grunt-contrib-sass": "^1.0.0",
    "grunt-contrib-watch": "^1.1.0",
    "grunt-postcss": "^0.9.0",
    "grunt-serve": "^0.1.6",
    "load-grunt-tasks": "^4.0.0",
    "material-components-web": "^0.39.1",
    "pixrem": "^4.0.1",
    "postcss-cssnext": "^3.1.0",
    "precss": "^3.1.2",
    "webpack-cli": "^3.1.2"
  }

Could there be a discrepancy somewhere that's causing this? I've referenced the following GitHub thread and other answers on StackOverflow and have followed their suggestions but am at a loss.

I was not getting this error until I did this command, as shown in this article about outputting multiple bundles with Browserify/Babel:

npm install grunt grunt-cli grunt-browserify babelify babel-preset-es2015 --save-dev

I'm not sure why that would break things. Doesn't npm automatically install the most up-to-date package? Should I try uninstalling those packages individually?

When I run npm install grunt, I keep seeing these warnings:

npm WARN [email protected] requires a peer of grunt@~0.4.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of webpack@^4.x.x but none is installed. You must install peer dependencies yourself.

Could this have something to do with the problem?

Thanks

1

There are 1 answers

0
David Gaskin On

I was able to resolve this by updating my Node.js system install to the 64-bit version as suggested by a commenter on a similar post (can't find it in my history).