Cli: [BUG] npm ls shows unmet dependency, but I see the folder in node_modules

Created on 10 Feb 2020  ·  12Comments  ·  Source: npm/cli

What / Why

See this output:

website git:master ❯ npm ls @tweenjs/tween.js

website@ /home/trusktr/src/lume+umbrella/apps/website
└── UNMET DEPENDENCY @tweenjs/tween.js@^18.5.0

npm ERR! missing: @tweenjs/tween.js@^18.5.0, required by website@

website git:master ❯ ls -ld node_modules/@tweenjs/tween.js
drwxr-xr-x 5 trusktr trusktr 4096 Feb 10 00:10 'node_modules/@tweenjs/tween.js'/

And inside that folder:

❯ ls -l node_modules/@tweenjs/tween.js
total 52
drwxr-xr-x 2 trusktr trusktr  4096 Feb 10 00:10 dist/
drwxr-xr-x 2 trusktr trusktr  4096 Feb 10 00:10 scripts/
drwxr-xr-x 2 trusktr trusktr  4096 Feb 10 00:10 src/
-rw-r--r-- 1 trusktr trusktr  3231 Feb 10 00:10 CODE_OF_CONDUCT.md
-rw-r--r-- 1 trusktr trusktr  1166 Feb 10 00:10 LICENSE
-rw-r--r-- 1 trusktr trusktr  2053 Feb 10 00:10 package.json
-rw-r--r-- 1 trusktr trusktr 10130 Feb 10 00:10 README.md
-rw-r--r-- 1 trusktr trusktr  9840 Feb 10 00:10 README_zh-CN.md
-rw-r--r-- 1 trusktr trusktr   338 Feb 10 00:10 rollup.config.js

Clearly Tween.js exists. Why might npm ls not think so?

When

Right before I wrote this, for the first time.

Where

  • n/a

How

Not sure

Current Behavior

see above

Steps to Reproduce

Wish I knew. I'll report back if I find out.

Expected Behavior

I think it should find the dependency.

Bug

Most helpful comment

Just as a follow up, it appears the issue I'm seeing is related to this discussion here: https://npm.community/t/resolved-fallback-in-npm-logical-tree/5885/3

What I've seen is ci installs do not have a _resolved field value in package.json that matches the _from which prevents npm ls from recognizing that the package is installed.

Appreciate your comments @ljharb . Thank you.

All 12 comments

What version is installed, though? It's not just that your dep graph requires @tweenjs/tween.js, it's that it requires it matching the semver range ^18.5.0. If it's not matching that presumed peer dep, your dep graph is invalid.

@ljharb if a package is installed from a branch commit, should npm ls show an unmet dependency?

We're having a similar issue where running npm ls after a npm ci install does not recognize the installed package (from a branch).

Example error:
npm ERR! missing: licensee@github:jslicense/licensee.js#09706be, required by [email protected]

@nzacca i would expect that a git package can never satisfy any dependency other than "*" (with the possible exception of a semver-style git tag)

@ljharb I see. So for the semver-style, do you mean something like this?

dependencies: {
  "licensee": "git://github.com/jslicense/licensee.js#semver:8.0.2"
}

npm ERR! missing: licensee@git://github.com/jslicense/licensee.js.git#semver:8.0.2, required by [email protected]

just #8.0.2, i think? i never use git deps so i'm not certain.

That didn't work unfortunately. Package installs fine but npm ls can't pick it up. We're trying to debug what the difference is between the ci install and install. It seems whatever metadata is being written for the package doesn't allow ls to recognize branch installs.

npm ERR! missing: licensee@git://github.com/jslicense/licensee.js.git#v8.0.2, required by [email protected]

Just as a follow up, it appears the issue I'm seeing is related to this discussion here: https://npm.community/t/resolved-fallback-in-npm-logical-tree/5885/3

What I've seen is ci installs do not have a _resolved field value in package.json that matches the _from which prevents npm ls from recognizing that the package is installed.

Appreciate your comments @ljharb . Thank you.

I've run into the same issue today. npm ci does not set _resolved but npm i does.

This makes certain workflows challenging.

For example I would do on CI npm ci && npm ls || exit 'bad package-lock/json'

Running a sanity check npm ls after installation to check if it's happy is common but npm ls does not understand git dependencies installed by npm ci.

I've run into this issue again. Using npm ci + npm ls + git+ssh dependencies is frustrating ...

I've think I've run into this as well today.

Locally, with npm v6.14.3, everything was fine with both install and ci. However, on CI, with npm v6.13.4 running an npm ls would fail with several UNMET DEPENDENCIES after using npm ci. Using npm install on the CI server works as expected.

Not sure what versions everyone else are using?

This happens to me a lot with symlinked dependencies. I don't think in the OP I had tween.js symlinked (no npm link).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

DullReferenceException picture DullReferenceException  ·  4Comments

darcyclarke picture darcyclarke  ·  3Comments

darcyclarke picture darcyclarke  ·  4Comments

MadhuriGurumurthy11 picture MadhuriGurumurthy11  ·  3Comments

chrisspen picture chrisspen  ·  3Comments