Skip to content

[BUG] npm install succeeded but update failed #5890

Closed
@alwaysmore

Description

@alwaysmore

Is there an existing issue for this?

  • I have searched the existing issues

This issue exists in the latest npm version

  • I am using the latest npm

Current Behavior

npm update failed because of ERESOLVE error, but npm install can still work. Even if I add the --strict-peer-deps or add strict-peer-deps=true.

PS C:\git\test> npm install

up to date, audited 83 packages in 1s

5 packages are looking for funding
run npm fund for details

4 vulnerabilities (1 moderate, 1 high, 2 critical)

To address all issues, run:
npm audit fix

Run npm audit for details.
PS C:\git\test> npm update
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: client.test@1.0.0
npm ERR! Found: webpack@5.75.0
npm ERR! node_modules/webpack
npm ERR! dev webpack@"^5.65.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer webpack@"^4.3.0" from null-loader@3.0.0
npm ERR! node_modules/null-loader
npm ERR! dev null-loader@"^3.0.0" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

Expected Behavior

I expect npm install should also show the errors when npm update is failed. Like this:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: client.test@1.0.0
npm ERR! Found: webpack@5.75.0
npm ERR! node_modules/webpack
npm ERR! dev webpack@"^5.65.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer webpack@"^4.3.0" from null-loader@3.0.0
npm ERR! node_modules/null-loader
npm ERR! dev null-loader@"^3.0.0" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

Steps To Reproduce

In the directory I have:
Mode LastWriteTime Length Name


d----- 24-Nov-2022 9:11 AM node_modules
-a---- 24-Nov-2022 9:24 AM 54442 package-lock.json
-a---- 24-Nov-2022 9:24 AM 125 package.json

It is from one of our project folder. And I simplify to these stuff. I think it has something to do with the stuff in node_modules. Because I tried to create a folder with only the package.json file, it works totally fine. Just when I got those three stuff together, it will failed on update but pass the install. If I delete package-lock.json or the node_modules, the problem stays the same. Only if I delete both, it will become normal.

package.txt
package-lock.txt
In the node_modules, there are:
Mode LastWriteTime Length Name


d----- 23-Nov-2022 9:18 PM .bin
d----- 23-Nov-2022 9:18 PM @types
d----- 23-Nov-2022 9:18 PM @webassemblyjs
d----- 23-Nov-2022 9:18 PM @xtuc
d----- 23-Nov-2022 9:18 PM acorn
d----- 23-Nov-2022 9:18 PM acorn-import-assertions
d----- 23-Nov-2022 9:18 PM ajv
d----- 23-Nov-2022 9:18 PM ajv-errors
d----- 23-Nov-2022 9:18 PM ajv-keywords
d----- 23-Nov-2022 9:18 PM browserslist
d----- 23-Nov-2022 9:18 PM buffer-from
d----- 23-Nov-2022 9:18 PM caniuse-lite
d----- 23-Nov-2022 9:18 PM chrome-trace-event
d----- 23-Nov-2022 9:18 PM colorette
d----- 23-Nov-2022 9:18 PM electron-to-chromium
d----- 23-Nov-2022 9:18 PM es-module-lexer
d----- 23-Nov-2022 9:18 PM escalade
d----- 23-Nov-2022 9:18 PM eslint-scope
d----- 23-Nov-2022 9:18 PM esrecurse
d----- 23-Nov-2022 9:18 PM estraverse
d----- 23-Nov-2022 9:18 PM events
d----- 23-Nov-2022 9:18 PM fast-deep-equal
d----- 23-Nov-2022 9:18 PM fast-json-stable-stringify
d----- 23-Nov-2022 9:18 PM glob-to-regexp
d----- 23-Nov-2022 9:18 PM graceful-fs
d----- 23-Nov-2022 9:18 PM jest-worker
d----- 23-Nov-2022 9:18 PM json-parse-better-errors
d----- 23-Nov-2022 9:18 PM json-schema-traverse
d----- 23-Nov-2022 9:18 PM loader-runner
d----- 23-Nov-2022 9:18 PM merge-stream
d----- 23-Nov-2022 9:18 PM mime-db
d----- 23-Nov-2022 9:18 PM mime-types
d----- 23-Nov-2022 9:18 PM neo-async
d----- 23-Nov-2022 9:18 PM node-releases
d----- 23-Nov-2022 9:18 PM null-loader
d----- 23-Nov-2022 9:18 PM punycode
d----- 23-Nov-2022 9:18 PM randombytes
d----- 23-Nov-2022 9:18 PM safe-buffer
d----- 23-Nov-2022 9:18 PM serialize-javascript
d----- 23-Nov-2022 9:18 PM source-map-support
d----- 23-Nov-2022 9:18 PM terser
d----- 23-Nov-2022 9:18 PM terser-webpack-plugin
d----- 23-Nov-2022 9:18 PM tslib
d----- 23-Nov-2022 9:18 PM uri-js
d----- 23-Nov-2022 9:18 PM watchpack
d----- 23-Nov-2022 9:18 PM webpack
d----- 23-Nov-2022 9:18 PM webpack-sources
-a---- 24-Nov-2022 9:24 AM 29952 .package-lock.json

Environment

  • npm: 8.19.2
  • Node.js: v16.18.1
  • OS Name: Windows 10 Enterprise
  • System Model Name: Dell
  • npm config:
; copy and paste output from `npm config ls` here

; "default" config from default values

_auth = (protected)
access = null
all = false
allow-same-version = false
also = null
audit = true
audit-level = null
auth-type = "legacy"
before = null
bin-links = true
browser = null
ca = null
cache = "C:\Users\Luther.Li\AppData\Local\npm-cache"
cache-max = null
cache-min = 0
cafile = null
call = ""
cert = null
ci-name = null
cidr = null
color = true
commit-hooks = true
depth = null
description = true
dev = false
diff = []
diff-dst-prefix = "b/"
diff-ignore-all-space = false
diff-name-only = false
diff-no-prefix = false
diff-src-prefix = "a/"
diff-text = false
diff-unified = 3
dry-run = false
editor = "notepad.exe"
engine-strict = false
fetch-retries = 2
fetch-retry-factor = 10
fetch-retry-maxtimeout = 60000
fetch-retry-mintimeout = 10000
fetch-timeout = 300000
force = false
foreground-scripts = false
format-package-lock = true
fund = true
git = "git"
git-tag-version = true
global = false
global-style = false
globalconfig = "C:\Users\Luther.Li\AppData\Roaming\npm\etc\npmrc"
heading = "npm"
https-proxy = null
if-present = false
ignore-scripts = false
include = []
include-staged = false
include-workspace-root = false
init-author-email = ""
init-author-name = ""
init-author-url = ""
init-license = "ISC"
init-module = "C:\Users\Luther.Li\.npm-init.js"
init-version = "1.0.0"
init.author.email = ""
init.author.name = ""
init.author.url = ""
init.license = "ISC"
init.module = "C:\Users\Luther.Li\.npm-init.js"
init.version = "1.0.0"
install-links = false
json = false
key = null
legacy-bundling = false
legacy-peer-deps = false
link = false
local-address = null
location = "user"
lockfile-version = null
loglevel = "notice"
logs-dir = null
logs-max = 10
; long = false ; overridden by cli
maxsockets = 15
message = "%s"
metrics-registry = "https://registry.npmjs.org/"
node-options = null
node-version = "v16.18.1"
noproxy = [""]
npm-version = "8.19.2"
offline = false
omit = []
omit-lockfile-registry-resolved = false
only = null
optional = null
otp = null
pack-destination = "."
package = []
package-lock = true
package-lock-only = false
parseable = false
prefer-offline = false
prefer-online = false
; prefix = "C:\Program Files\nodejs" ; overridden by builtin
preid = ""
production = null
progress = true
proxy = null
read-only = false
rebuild-bundle = true
registry = "https://registry.npmjs.org/"
replace-registry-host = "npmjs"
save = true
save-bundle = false
save-dev = false
save-exact = false
save-optional = false
save-peer = false
save-prefix = "^"
save-prod = false
scope = ""
script-shell = null
searchexclude = ""
searchlimit = 20
searchopts = ""
searchstaleness = 900
shell = "C:\WINDOWS\system32\cmd.exe"
shrinkwrap = true
sign-git-commit = false
sign-git-tag = false
sso-poll-frequency = 500
sso-type = "oauth"
strict-peer-deps = false
strict-ssl = true
tag = "latest"
tag-version-prefix = "v"
timing = false
tmp = "C:\Users\Luther.Li\AppData\Local\Temp"
umask = 0
unicode = false
update-notifier = true
usage = false
user-agent = "npm/{npm-version} node/{node-version} {platform} {arch} workspaces/{workspaces} {ci}"
userconfig = "C:\Users\Luther.Li\.npmrc"
version = false
versions = false
viewer = "browser"
which = null
workspace = []
workspaces = null
workspaces-update = true
yes = null

; "builtin" config from C:\Program Files\nodejs\node_modules\npm\npmrc

prefix = "C:\Users\Luther.Li\AppData\Roaming\npm"

; "cli" config from command line options

long = true

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixingNeeds Triageneeds review for next stepsRelease 8.xwork is associated with a specific npm 8 release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions