2013-05-07 3 views
0

J'essaie d'installer grunt.js. Comme le dit official docs, je courraiserreur lors de l'installation gruntjs (package node.js/npm)

npm install -g grunt-cli 

en tant que root (j'utilise linux ubuntu). Je suis en train - et je reçois l'erreur suivante:

$ sudo npm install -g grunt-cli 
npm ERR! sudon't! 
npm ERR! sudon't! Running npm as root is not recommended! 
npm ERR! sudon't! Seriously, don't do this! 
npm ERR! sudon't! 
npm ERR! couldn't read package.json in . 
npm ERR! Error installing . 
npm ERR! Error: ENOENT, No such file or directory 'package.json' 
npm ERR! Report this *entire* log at <http://github.com/isaacs/npm/issues> 
npm ERR! or email it to <[email protected]> 
npm ERR! Just tweeting a tiny part of the error will not be helpful. 
npm not ok 

Quelqu'un peut-il expliquer s'il vous plaît:

[1] why npm says `sudon't` and grunt docs says `do sudo`? And what is it all about? 
[2] I want to install the grunt as a tool. Why does the message complains about missing package.json which is project-dependent (and I don't want to run grunt on any project, I want to install it globally first)? 
[3] what can I do to make it install successfully? 
+0

Quelle version de noeud utilisez-vous? On dirait que cela a été résolu il y a longtemps: http://stackoverflow.com/questions/4938592/how-why-does-npm-recommend-not-running-as-root – jgillich

+0

0.4.9 à partir de paquets oneiric ocelot. Eh bien, je ne comprends pas très bien de quoi il s'agit, mais je veux juste installer 'grunt.js' ... – ducin

Répondre

0

La solution a été assez difficile ... J'utilise ubuntu ocelot maverick, qui était encore entretenu il y a une semaine (ce n'est pas si vieux). J'ai installé node.js par l'intermédiaire des paquets ubuntu par défaut et il s'est avéré être le problème - j'ai la version 0.4.9 installée, qui semble être vieux, étrange et étrange (je n'avais aucune expérience avec node.js auparavant). Je l'ai supprimé et j'ai suivi les instructions de https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager - ajouté le dépôt de paquet distant et installé node.js à partir de là. Maintenant, j'ai un brillant 0.10.5 avec sudo npm installation fonctionne parfaitement bien sans aucune plainte.

Questions connexes