npm error: must provide string spec

· klm's blog


Original post is here: eklausmeier.goip.de

I tried to install some npm packets with npm install. This failed with error

npm install npm ERR! must provide string spec

Looking into the source of the error in the entire npm under /lib/node_modules/npm:

node_modules/@npmcli/arborist/lib/edge.js
51:      throw new TypeError('must provide string spec')

did not provide any hint what the actual error was. Lots of googling hinted at deleting files and directories.

Solution is as follows. In my home-directory:

  1. Deleted node_modules directory
  2. Deleted files package.json and package-lock.json