npm WARN old lockfile
npm WARN old lockfile The package-lock.json file was created with an old version of npm
There are several ways to deal with this:
- Ignore it. It’s just a warning and does not affect the installation of modules.
- Run
npm ci
to make sure yournode_modules
reflects the lock file, then removepackage-lock.json
, and then runnpm install
(with the newer version ofnpm
) to regenerate apackage-lock.json
. Because everything innode_modules
will meet all the requirements, the only change fromnpm install
will be a newly-generatedpackage-lock.json
file. Commit the updated version ofpackage-lock.json
to the repo/Docker image or whatever. - Downgrade
npm
to an older version in production. Consider runningnpm
version 6 as that is what ships with the current (as of this writing) LTS version of Node.js. In the case being asked about in this question, I imagine you can just leave out theRUN npm -g install npm@7.19.1
from the Dockerfile and instead use the version ofnpm
that is installed with the Docker image (which in this case will almost certainly benpm@6
since that is what ships with Node.js 14.x). - If you want to run one command with an older version of
npm
but otherwise keep the newer version, you can usenpx
(which ships withnpm
) to do that. Use the-p
flag to specify the version ofnpm
you want. For example,npx -p npm@6 npm ci
would runnpm ci
withnpm
version 6 even if you have version 7 installed.
npm show latest versions
npm to show latest and safe versions of all your installed packages, you can also use:
npm outdated
npm show installed package versions
to show installed packages and versions
npm list
for local packages or npm list -g
for globally installed packages.
You can find the version of a specific package by passing its name as an argument. For example, npm list grunt
will result in:
projectName@projectVersion /path/to/project/folder
└── grunt@0.4.1
Alternatively, you can just run npm list
without passing a package name as an argument to see the versions of all your packages:
├─┬ cli-color@0.1.6
│ └── es5-ext@0.7.1
├── coffee-script@1.3.3
├── less@1.3.0
├─┬ sentry@0.1.2
│ ├── file@0.2.1
│ └── underscore@1.3.3
└── uglify-js@1.2.6
You can also add --depth=0
argument to list installed packages without their dependencies.
About the Author: markoze
I'm an exploring artist, illustrator and creator of digital media (2D graphics, illustrations and 3D designs). I share my works, tutorials, tips, free art, items and tools. I also create websites (and apps) for organizations, communities, groups, people movements, faith organizations and more.
Recent posts
Posts categories
Recent artworks
Printed artworks and merchandise
Recommended
- Recommended products and links may be affiliated links
Related Posts
All tags
3d
anna
applications
apps
artists
blender
color
concept
content
design
digital
elementor
emoticons
flag
free
gradient
gradients
Hopper
hosting
Inkscape
keys
mesh
model
painting
path
plugins
quiz
scifi
Sharp
software
spaceship
speech platform
steps
survey
Tables
text to speech
tips
tools
tts
vector
view
web
website
windows
wordpress