2016-04-12 16 views
1

Hallo, ich habe ein Problem bei der Installation von Npm: Ich versuche zu entfernen und neu zu installieren, funktioniert aber nicht, sogar alle Ordner entfernen.Wie behebt man das bei npm install: (npm ERR! Install Konnte Abhängigkeiten nicht lesen)?

> [email protected]:~$ npm install 
> npm ERR! install Couldn't read dependencies 
> npm ERR! Linux 4.2.0-35-generic 
> npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" 
> npm ERR! node v4.4.2 
> npm ERR! npm v2.15.0 
> npm ERR! file /home/lucas/package.json 
> npm ERR! code EJSONPARSE 

> npm ERR! Failed to parse json 
> npm ERR! Unexpected token ':' at 1:17 
> npm ERR! "dependencies": { 
> npm ERR!    ^
> npm ERR! File: /home/lucas/package.json 
> npm ERR! Failed to parse package.json data. 
> npm ERR! package.json must be actual JSON, not just JavaScript. 
> npm ERR! 
> npm ERR! This is not a bug in npm. 
> npm ERR! Tell the package author to fix their package.json file. JSON.parse 

> npm ERR! Please include the following file with any support request: 
> npm ERR!  /home/lucas/npm-debug.log 
+1

Es scheint, dass Ihre Datei package.json kein gültiger JSON ist. Können Sie die vollständige Datei bereitstellen? – Komo

Antwort

0

Sie NPM erzählt, was los ist:

> npm ERR! File: /home/lucas/package.json 
> npm ERR! Failed to parse package.json data. 
> npm ERR! package.json must be actual JSON, not just JavaScript. 
> npm ERR! 
> npm ERR! This is not a bug in npm. 
> npm ERR! Tell the package author to fix their package.json file. JSON.parse 

Achten Sie darauf, Ihre JSON-Datei gültig ist. Sie können es überprüfen on JSONLint. So sollte der Abschnitt Abhängigkeiten aussehen. Beachten Sie die umgebenden Objektklammern.

{ "dependencies" : 
    { "foo" : "1.0.0 - 2.9999.9999" 
    , "bar" : ">=1.0.2 <2.1.2" 
    , "baz" : ">1.0.2 <=2.3.4" 
    , "boo" : "2.0.1" 
    , "qux" : "<1.0.0 || >=2.3.1 <2.4.5 || >=2.5.2 <3.0.0" 
    , "asd" : "http://asdf.com/asdf.tar.gz" 
    , "til" : "~1.2" 
    , "elf" : "~1.2.3" 
    , "two" : "2.x" 
    , "thr" : "3.3.x" 
    , "lat" : "latest" 
    , "dyl" : "file:../dyl" 
    } 
} 

See this writeup über die „Abhängigkeiten“ Abschnitt von NPM in der Dokumentation, und stellen Sie sicher, dass Ihr Abschnitt package.json ähnlich sieht, vor allem alle Zeichen kommen vor „Abhängigkeiten“.