Skip to content

Docker build fails at fetch-examples: Cannot find module '../models/user #3714

@nbogie

Description

@nbogie

p5.js version

n/a current develop branch #2c52f25bec4a5acddca2a04c290f59df8846e9d3

What is your operating system?

Mac OS

Web browser and version

n/a

Actual Behavior

On a new clone and fresh (docker-based) install and full build of the project, the build step goes fine but the fetch-examples step fails.

docker-compose -f docker-compose-development.yml build

Output:

[omitted - no problems.  will attach as file]
...
p5webeditor-again-app  Built

(exit code 0)

Then it fails on the following:

docker-compose -f docker-compose-development.yml run --rm app npm run fetch-examples

Output:

✔ Container p5webeditor-again-mongo-1  Running                                                                                                        0.0s

> p5.js-web-editor@2.18.4 fetch-examples
> cross-env NODE_ENV=development node ./server/scripts/fetch-examples.js

node:internal/modules/cjs/loader:1143
  throw err;
  ^

Error: Cannot find module '../models/user'
Require stack:
- /usr/src/app/server/scripts/examples.js
- /usr/src/app/server/scripts/fetch-examples.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1140:15)
    at Function.Module._load (node:internal/modules/cjs/loader:981:27)
    at Module.require (node:internal/modules/cjs/loader:1231:19)
    at require (node:internal/modules/helpers:177:18)
    at Object.<anonymous> (/usr/src/app/server/scripts/examples.js:7:1)
    at Module._compile (node:internal/modules/cjs/loader:1364:14)
    at Module._compile (/usr/src/app/node_modules/pirates/lib/index.js:117:24)
    at Module._extensions..js (node:internal/modules/cjs/loader:1422:10)
    at Object.newLoader [as .js] (/usr/src/app/node_modules/pirates/lib/index.js:121:7)
    at Module.load (node:internal/modules/cjs/loader:1203:32)
    at Function.Module._load (node:internal/modules/cjs/loader:1019:12)
    at Module.require (node:internal/modules/cjs/loader:1231:19)
    at require (node:internal/modules/helpers:177:18)
    at Object.<anonymous> (/usr/src/app/server/scripts/fetch-examples.js:8:1)
    at Module._compile (node:internal/modules/cjs/loader:1364:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1422:10)
    at Module.load (node:internal/modules/cjs/loader:1203:32)
    at Function.Module._load (node:internal/modules/cjs/loader:1019:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:128:12)
    at node:internal/main/run_main_module:28:49 {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/usr/src/app/server/scripts/examples.js',
    '/usr/src/app/server/scripts/fetch-examples.js'
  ]
}

Node.js v18.20.8

Extra info:

At a guess it looks like the TS is not being transpiled, or not picked up, despite the PR #3696 which I see has been merged into develop.

After manually adding in a .js version of /server/models/user.ts (and a couple of other dependencies) into the same dir, I'm able to re-run this fetch-examples step and see it complete without problem. (Subsequently, I could bring the server up and use the editor successfully, too.)
This suggests my system setup isn't wildly wrong, at least.

I found #3694 (closed) but the errors are different, so not a duplicate, I think? Should I just add to that issue?

Expected Behavior

Expected to fork, clone the develop branch of the web editor, and run through the docker-based install+build instructions and get the server running without the build process failing.

Steps to reproduce

  1. install docker
  2. install docker desktop
  3. clone develop branch of this repo (commit #2c52f25bec4a5acddca2a04c290f59df8846e9d3) and cd in
  4. run docker-compose -f docker-compose-development.yml build
  5. create oauth app on github
  6. add github credentials to .env, per the guide
  7. rundocker-compose -f docker-compose-development.yml run --rm app npm run fetch-examples

Metadata

Metadata

Assignees

No one assigned

    Labels

    Awaiting Maintainer ApprovalNeeds review from a maintainer before moving forwardBugError or unexpected behaviors

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions