Npm Install -G Grunt-Cli Failed in Linux

npm install -g grunt-cli failed in Linux

I don't recommend to use sudo for your npm installations (any sudo npm install), it seems like you need to update your repository, I'm not sure whet distro you are using but if debian or ubuntu you should do something like:

sudo apt-get update
sudo apt-get install -y python-software-properties python g++ make
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs

for more info read how to install node from npm

Why npm install -g grunt-cli doesn't work correctly?

In one of your .npmrc files, you probably have prefix=/Users/trott/.npm-packages. If so, leave it and create the directory with mkdir ~/.npm-packages. Or set it to a different directory. Or remove the entry entirely.

The places to look for the .npmrc file that may be causing this to happen:

  • per-project config file (/path/to/my/project/.npmrc)
  • per-user config file (~/.npmrc)
  • global config file ($PREFIX/etc/npmrc)
  • npm builtin config file (/path/to/npm/npmrc)

sudo npm install -g grunt-cli gives me an error

According to the maintainer of npm, installing packages with sudo is considered bad practice because you are allowing that package to have complete control of your system and you can't and SHOULDN'T trust these packages with root access. Think Debian's long release cycles as an extreme example of protecting end users from community maintained packages for this exact reason.

http://howtonode.org/introduction-to-npm

You should do what Issaacs suggests and chown your /usr/local folder so you have RW permissions.

Can't install grunt-cli but can install bower

The problem was my npm proxy was host:port, without the "http://" prefix. like the environment variable. works now.

I have no idea why bower installed though.

How can I install the grunt-cli without getting errors?

All it took was adding 'sudo', since I didn't have permission to install the grunt-cli by default. Once I ran the following command and entered my password, it worked as expected.

sudo npm install -g grunt-cli

Hope this helps someone!

grunt install returns error on Ubuntu

What is the grunt install task? Can you please paste your package.json file here so we may see your dependencies?

The reason jit-grunt is outputting that error is because it cannot find a node module folder named grunt-contrib-install, grunt-install, or install, with a tasks/ folder with JS files that register a Grunt task named install.

Do you mean either of these packages? If so, you have to call them via their registered task names:
- https://www.npmjs.org/package/grunt-npm-install – grunt npm-install
- https://www.npmjs.org/package/grunt-auto-install – grunt auto_install

For the grunt-auto-install package, you will need to add it to jit-grunt's static mappings, like you have with grunt-express-server and others.


If it's not the above, apart from "maybe you mistyped?", the only other answer I can offer is similar to the assumption @waqas-ahmed made: that you mean to install dependencies and devDependencies from your package.json file, and that perhaps you mean to call npm install, not grunt install.

Fatal error: Unable to find local grunt. when running grunt command

All is explained quite nicely on gruntjs.com.

Note that installing grunt-cli does not install the grunt task runner!
The job of the grunt CLI is simple: run the version of grunt which has
been installed next to a Gruntfile. This allows multiple versions of
grunt to be installed on the same machine simultaneously.

So in your project folder, you will need to install (preferably) the latest grunt version:

npm install grunt --save-dev

Option --save-dev will add grunt as a dev-dependency to your package.json. This makes it easy to reinstall dependencies.



Related Topics



Leave a reply



Submit