26

npm returns the following message after using npm list -g

npm ERR! missing: atom-package-manager@*, required by undefined@undefined
npm ERR! missing: opal-npm-wrapper@git://github.com/anthonny/opal-npm-wrapper.git#0.1.1, required by asciidoctor.js@1.5.2
npm ERR! missing: xmlhttprequest@~1.6.0, required by asciidoctor.js@1.5.2

screenshot:

1
  • what was the output of the npm install? Did it report any missing optional dependencies? Jun 28, 2018 at 15:25

4 Answers 4

16

I know this an old question but I've been strugging with a similar issue and figure I'd at least add what worked for me...

Problem

Running npm list -g lists all packages as expected and then throws a variety of errors including the missing errors, as mentioned above, and, for me at least, a bunch of invalid and extraneous errors such as this:

extraneous: aws-sign2@0.5.0 /usr/local/lib/node_modules/npm/node_modules/aws-sign2

I tried a bunch of solutions including npm upgrade, npm prune, as well as installing missing packages, which for me was semver:

missing: semver@2 || 3, required by normalize-package-data@1.0.1

I'm still not sure of the exact cause for these errors, though I believe this happened when I upgraded to 3.3.6.

Solution

After some headache I ran:

npm update -g --verbose

which upgraded me from v3.3.6 to v3.5.3 and got rid of all the errors. Note that the --verbose is not necessary but helpful to see what exactly is happening. Now my npm list -g returns a clean output:

/usr/local/lib
├── npm@3.5.3
└── semver@2.3.2

Hope this helps someone, please comment if I've stated any inaccuracies or if there's something I can add here.

2
  • 1
    A downvote with no comment? Please elaborate... if this answer is incorrect or causes issues I'm happy to delete). Oct 10, 2017 at 18:39
  • 1
    npm update -g --verbose didn't help. npm cache clean --force didn't help either. In my case, one of CLI apps was symlinked and it's from Lerna local folder so all deps were symlinked and deemed missing by npm. I reinstalled public version of it, same package but it's like phantom error which persists. Reported ERR dependencies are in place. It's not solved...
    – revelt
    May 31, 2019 at 9:49
7

For anyone having the same problem, try to run:

npm dedupe

for more info about npm dedupe please refer to the documentation. https://docs.npmjs.com/cli/dedupe.html

2

Remove package-lock.json in /usr/local/lib.

3
  • 2
    It'd be a huge help to readers if you explained why this is the right answer, and how you worked out that it was the problem. Apr 11, 2020 at 15:21
  • 1
    The file /usr/local/lib/package-lock.json does not exist - though, the folder exists and contains the subfolder node_modules.
    – Philipp
    Jan 3, 2021 at 14:49
  • The package.lock.json stamps exact versions into your repo. By removing it and re-running you allow npm to go and rebuild all the dependencies from scratch and to resolve any conflicts as part of this.
    – Liam
    Aug 20, 2021 at 10:58
0

You must have a global package named asciidoctor.js that is installed before its dependency packages are installed. I ran into the same problem today: some of my global package has "UNMET DEP" in its tree structure(run npm list -g to see the full depth of each global package), meaning its subdependencies are missing.

I solved by reinstalling each global package. If you had this problem on Arch Linux, first check this post: I have unmet dependencies

I had this problem surfaced after I sudo pacman -Syu and I have a bunch of ERROR missing semver and node-pyg.

As a side note, under Arch Linux node-pyg and semver are installed as dependencies before npm is installed through pacman(rather than through npm), and I guess the order these two are installed or updated matters. Probably under other OS or linux distros, these two packages are not listed in the repository.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.