2016-05-17 5 views
0

Ich habe vor kurzem eine Webseite erhalten, die aus einer index.html, sass-Dateien, Javascript-Dateien und ein paar Konfigurationsdateien besteht. Ich habe versucht, den Befehl npm install im Hauptprojektverzeichnis auszuführen, und ich habe den folgenden Fehler erhalten. Keine kompatible Version gefunden: grunt-contrib-concat @ 'node_modules/grunt-contrib-concat'

{ 
    "name": "project", 
    "version": "0.0.0", 
    "devDependencies": { 
    "glob": "~4.3.1", 
    "grunt": "~0.4.1", 
    "grunt-autoprefixer": "~2.0.0", 
    "grunt-concat-css": "^0.3.1", 
    "grunt-contrib-concat": "node_modules/grunt-contrib-concat", 
    "grunt-contrib-connect": "~0.9.0", 
    "grunt-contrib-cssmin": "~0.11.0", 
    "grunt-contrib-imagemin": "^1.0.0", 
    "grunt-contrib-jshint": "~0.10.0", 
    "grunt-contrib-sass": "~0.8.1", 
    "grunt-contrib-uglify": "~0.7.0", 
    "grunt-contrib-watch": "~0.6.1" 
    }, 
    "dependencies": { 
    "load-grunt-tasks": "~2.0.0" 
    } 
} 

Ich bin wirklich neu in der npm Befehl und alle damit zusammenhängenden Gegenstand

npm ERR! Error: No compatible version found: [email protected]'node_modules/grunt-contrib-concat' 
npm ERR! Valid install targets: 
npm ERR! ["0.1.0","0.1.1","0.1.2","0.1.3","0.2.0","0.3.0","0.4.0","0.5.0","0.5.1","1.0.0","1.0.1","0.1.2-rc5","0.1.2-rc6"] 
npm ERR!  at installTargetsError (/usr/share/npm/lib/cache.js:719:10) 
npm ERR!  at /usr/share/npm/lib/cache.js:638:10 
npm ERR!  at saved (/usr/share/npm/node_modules/npm-registry-client/lib/get.js:142:7) 
npm ERR!  at /usr/lib/nodejs/graceful-fs/polyfills.js:133:7 
npm ERR!  at Object.oncomplete (fs.js:107:15) 
npm ERR! If you need help, you may report this log at: 
npm ERR!  <http://github.com/isaacs/npm/issues> 
npm ERR! or email it to: 
npm ERR!  <[email protected]> 

npm ERR! System Linux 4.4.0-x86_64-linode63 
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install" 
npm ERR! cwd /var/www/project.com/public_html_staging 
npm ERR! node -v v0.10.25 
npm ERR! npm -v 1.3.10 
npm ERR! 
npm ERR! Additional logging details can be found in: 
npm ERR!  /var/www/project.com/public_html_staging/npm-debug.log 
npm ERR! not ok code 0 

Dies ist, was mein package.json wie

aussieht. Wie beginne ich, diesen Fehler zu beheben? Oder kennt jemand die Lösung?

Antwort

0

Das Problem wurde durch die Tatsache verursacht, dass ich NodeJS Version 0.1 verwendete, während das Projekt ursprünglich auf einem Server mit NodeJS v5 erstellt wurde. Daher hatte der npm nicht die richtigen Grunt-Abhängigkeiten.

Ich habe das Folgende als Root-Benutzer auf meinem betroffenen Server

apt-get purge nodejs 
apt-get purge npm 
apt-get autoremove // remove any orphan dependences 

Sobald ich alles losgeworden, ich Version 6 von NodeJS installieren gemäß der NodeJS Website mit diesen Befehlen:

curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - 
sudo apt-get install -y nodejs 

Der NodeJS kam schon mit seinem eigenen npm, also musste ich nichts anderes machen.

Dann, als ich lief npm install, es ordnungsgemäß heruntergeladen alle notwendigen Module, um mein Projekt zu laufen.