Node cannot find an existing module or install new ones after copy on another computer

I copied my project to a new computer (in fact, I use a synchronization service). I checked my folder with ls -l and I am the permissions seem right.

It is a strapi app, and when I execute npm run develop, here is what appears:

> [email protected] develop
> strapi develop

sh: 1: strapi: not found

I created my app with npx create-strapi-app@latest strapi-hugo-blog, so strapi was installed as a dependency that I updated later with npm install on the original computer.

So this is strange. When I execute a new npm install, here is what I get:

npm ERR! code 1
npm ERR! path /home/me/my-app/node_modules/esbuild
npm ERR! command failed
npm ERR! command sh -c node install.js
npm ERR! node:internal/errors:491
npm ERR!     ErrorCaptureStackTrace(err);
npm ERR!     ^
npm ERR! 
npm ERR! <ref *1> Error: spawnSync /home/me/my-app/node_modules/esbuild/bin/esbuild EACCES
npm ERR!     at Object.spawnSync (node:internal/child_process:1110:20)
npm ERR!     at spawnSync (node:child_process:871:24)
npm ERR!     at Object.execFileSync (node:child_process:914:15)
npm ERR!     at validateBinaryVersion (/home/me/my-app/node_modules/esbuild/install.js:96:28)
npm ERR!     at /home/me/my-app/node_modules/esbuild/install.js:283:5 {
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'spawnSync /home/me/my-app/node_modules/esbuild/bin/esbuild',
npm ERR!   path: '/home/me/my-app/node_modules/esbuild/bin/esbuild',
npm ERR!   spawnargs: [ '--version' ],
npm ERR!   error: [Circular *1],
npm ERR!   status: null,
npm ERR!   signal: null,
npm ERR!   output: null,
npm ERR!   pid: 0,
npm ERR!   stdout: null,
npm ERR!   stderr: null
npm ERR! }
npm ERR! 
npm ERR! Node.js v18.13.0

I found this error message nowhere on the internet.

When I just try to install strapi, I get more errors and warnings before (apparently it tries to use Strapi version 3, which is deprecated, whereas I have version 4 in my package-lock) but at the end appears the same message.

Executing npm with sudo does not change anything (and it shouldn't, as everything is installed locally).

As I'm using a synchronization service, I tried again on my original computer and everything works fine. Node is installed and is almost at the same version on both systems (v18.17.1 / v18.13.0).


  • The best way to solve issues like this to delete your node_modules directory and package-lock.json files, and then do a clean install with npm install.

    The reason copying over node_modules might not work is because both computers might be running different operating systems, or different OS versions, or different architecture, or different node/npm versions, and so on.