SyntaxError: Unerwarteter Bezeichner beim Versuch, npm global zu installieren

SyntaxError: Unerwarteter Bezeichner beim Versuch, npm global zu installieren

Ich stehe vor einem Problem!

Wenn Sie den folgenden Befehl ausführen subrara@subrara-desktop:~$ sudo npm install npm --global

Ich erhalte Folgendes:

/usr/lib/node_modules/npm/bin/npm-cli.js:85
      let notifier = require('update-notifier')({pkg})
          ^^^^^^^^
SyntaxError: Unexpected identifier
    at Module._compile (module.js:439:25)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:935:3

Ich habe Node und NPM bereits installiert und möchte nun auf die neueste stabile Version von NPM aktualisieren.

Betriebssystem: Ubuntu 14.04 LTS Trusty

Bitte vorschlagen!

Antwort1

Für mich ist es besser, die npmund die vollständig zu entfernen node, indem ich Folgendes ausführe:

sudo apt-get remove nodejs
sudo apt-get remove npm
sudo apt-get update
which node

Und installieren Sie es mithilfe nvmdes Node-Versionsmanagements neu. Zur Installation nvmfolge ich dieser Anleitung.https://gist.github.com/d2s/372b5943bce17b964a79

verwandte Informationen