How to uninstall corrupted NPM?

24,635

Uninstall it with sudo npm uninstall npm -g

Share:
24,635

Related videos on Youtube

Sergii
Author by

Sergii

Updated on September 18, 2022

Comments

  • Sergii
    Sergii almost 2 years

    Question is simple, and solution should be simple. More details about my problem. Check npm:

    ~ npm -version
    >> 4.0.5
    ~ which npm
    >> /usr/local/bin/npm
    

    try uninstall:

    ~ sudo apt-get remove npm
    >> Package 'npm' is not installed, so not removed
    

    ok, lets install it than if it isn't:

    ~ sudo apt-get install npm
    npm: Depends: nodejs but it will not be installed
           Depends: node-abbrev (> = 1.0.4) but it is not installed
           Depends: node-ansi but it will not be installed
           Depends: node-archy but it will not be installed
           Depends: node-block-stream but it will not be installed
           Depends: node-fstream (> = 0.1.22) but it is not installed
           Depends: node-fstream-ignore but it is not installed
           Depends: node-github-url-from-git but he will not be installed
           Depends: node-glob (> = 3.1.21) but it is not installed
           Depends: node-graceful-fs (> = 2.0.0) but it is not installed
           Depends: node-inherits but it will not be installed
           Depends: node-ini (> = 1.1.0) but it is not installed
           Depends: node-lockfile but it will not be installed
           Depends: node-lru-cache (> = 2.3.0) but it is not installed
           Depends: node-minimatch (> = 0.2.11) but it is not installed
           Depends: node-mkdirp (> = 0.3.3) but it is not installed
           Depends: node-gyp (> = 0.10.9) but it will not be installed
           Depends: node-nopt (> = 2.1.1) but it is not installed
           Depends: node-npmlog but it will not be installed
           Depends: node-once but it will not be installed
           Depends: node-osenv but it will not be installed
           Depends: node-read but it is not installed
           Depends: node-read-package-json (> = 1.1.0) but it is not installed
           Depends: node-request (> = 2.25.0) but it will not be installed
           Depends: node-retry but it will not be installed
           Depends: node-rimraf (> = 2.2.2) but it is not installed
           Depends: node-semver (> = 2.1.0) but it is not installed
           Depends: node-sha but it will not be installed
           Depends: node-slide but it will not be installed
           Depends: node-tar (> = 0.1.18) but it is not installed
           Depends: node-which but it will not be installed
    E: Unable to correct problems, you have delayed (held) broken packages.
    

    So I can not neither install nor uninstall it. Lets see held

    ~ dpkg --get-selections | grep hold
    >> [no results]
    

    nodejs:

    ~ nodejs -v
    >> v0.12.18
    

    I can not remove my npm and I can not update one. Is there any solutions for me?


    Add more details:

    npm uninstall npm -g
    

    a lot of logs nad errors in the very end:

    - [email protected] node_modules/npm
    npm ERR! Linux 3.13.0-37-generic
    npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "uninstall" "npm" "-g"
    npm ERR! node v7.4.0
    npm ERR! npm  v4.0.5
    npm ERR! path /usr/local/lib/node_modules/npm/node_modules/abbrev
    npm ERR! code EACCES
    npm ERR! errno -13
    npm ERR! syscall access
    
    npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules/npm/node_modules/abbrev'
    npm ERR!  { Error: EACCES: permission denied, access '/usr/local/lib/node_modules/npm/node_modules/abbrev'
    npm ERR!   errno: -13,
    npm ERR!   code: 'EACCES',
    npm ERR!   syscall: 'access',
    npm ERR!   path: '/usr/local/lib/node_modules/npm/node_modules/abbrev' }
    npm ERR! 
    npm ERR! Please try running this command again as root/Administrator.
    
    npm ERR! Please include the following file with any support request:
    npm ERR!     /media/storage/development/projects/web/angular-app/npm-debug.log
    
  • Sergii
    Sergii over 7 years
    I have just tried this instruction, details are added to the my question after separate line.
  • 13dimitar
    13dimitar over 7 years
    try with sudo
  • Sergii
    Sergii over 7 years
    sorry forgot this command and did not read error details to the end. First opinion was problem is in 2 different installed versions