Are you running the wrong version of NPM ?

If you are seeing errors like this:

old lockfile This is a one-time fix-up, please be patient e401
Cannot find module 'express'

In my case at least, I was running a newer version of npm that was incompatible with the build. Even the node_modules sub-directory was not getting created with “node install”.

Solution:

npx @npm6 install
npx npm@6 install express

# to show versions
npm --version
8.8.0
npx npm@6 --version
6.14.17

Or a better option is to use “nvm” Node Version Manager. Here are some examples:

BTW, in the example below, I had already done a: node install 14.19.1

nvm ls
->     v14.19.1
       v14.19.3
       v16.15.0
default -> 16 (-> v16.15.0)
node -> stable (-> v16.15.0) (default)
stable -> 16.15 (-> v16.15.0) (default)
iojs -> N/A (default)
unstable -> N/A (default)
lts/* -> lts/gallium (-> v16.15.0)
lts/argon -> v4.9.1 (-> N/A)
lts/boron -> v6.17.1 (-> N/A)
lts/carbon -> v8.17.0 (-> N/A)
lts/dubnium -> v10.24.1 (-> N/A)
lts/erbium -> v12.22.12 (-> N/A)
lts/fermium -> v14.19.3
lts/gallium -> v16.15.0

So a question that I asked myself, is what versions of node correspond to what version of NPM?

Leave a Comment

Scroll to Top