Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build and host your own Juno application Issues #325

Open
notandy opened this issue Apr 21, 2023 · 1 comment
Open

Build and host your own Juno application Issues #325

notandy opened this issue Apr 21, 2023 · 1 comment

Comments

@notandy
Copy link

notandy commented Apr 21, 2023

Hi, I followed the guide and found following issues:

esbuild not found

running first npm run start failes with:

[qa-de-1:monsoon3][~/go/src/github.com/sapcc/andromeda/web]$ npm run start                                                                                                                                                                *[main]


> andromeda@1.0.1 start
> PORT=$APP_PORT NODE_ENV=development node esbuild.config.js --serve --watch

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

Error: Cannot find module 'esbuild'
Require stack:
- /Users/d072895/go/src/github.com/sapcc/andromeda/web/esbuild.config.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1082:15)
    at Module._load (node:internal/modules/cjs/loader:928:27)
    at Module.require (node:internal/modules/cjs/loader:1149:19)
    at require (node:internal/modules/helpers:121:18)
    at Object.<anonymous> (/Users/d072895/go/src/github.com/sapcc/andromeda/web/esbuild.config.js:1:17)
    at Module._compile (node:internal/modules/cjs/loader:1267:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1321:10)
    at Module.load (node:internal/modules/cjs/loader:1125:32)
    at Module._load (node:internal/modules/cjs/loader:965:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/d072895/go/src/github.com/sapcc/andromeda/web/esbuild.config.js'
  ]
}

Node.js v20.0.0

fixed with npm install --save-dev esbuild

Cannot find module '../../helpers/appProps'

[qa-de-1:monsoon3][~/go/src/github.com/sapcc/andromeda/web]$ npm run start                                                                                                                                                                          *[main]


> andromeda@1.0.1 start
> PORT=$APP_PORT NODE_ENV=development node esbuild.config.js --serve --watch

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

Error: Cannot find module '../../helpers/appProps'
Require stack:
- /Users/d072895/go/src/github.com/sapcc/andromeda/web/esbuild.config.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1082:15)
    at Module._load (node:internal/modules/cjs/loader:928:27)
    at Module.require (node:internal/modules/cjs/loader:1149:19)
    at require (node:internal/modules/helpers:121:18)
    at Object.<anonymous> (/Users/d072895/go/src/github.com/sapcc/andromeda/web/esbuild.config.js:9:18)
    at Module._compile (node:internal/modules/cjs/loader:1267:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1321:10)
    at Module.load (node:internal/modules/cjs/loader:1125:32)
    at Module._load (node:internal/modules/cjs/loader:965:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/d072895/go/src/github.com/sapcc/andromeda/web/esbuild.config.js'
  ]
}

fixed by copying appProps.js from juno helpers/appProps to base directory and adapting the path in esbuild.js to const appProps = require("./appProps")

npm serve always deletes contents of public/ folder

esbuild.config.js defines following lines:

  // delete build folder and re-create it as an empty folder
  await fs.rm(outdir, { recursive: true, force: true })
  await fs.mkdir(outdir, { recursive: true })

When using serve, it's deleting the contents of public which is not really nice since it should host the index.html and favicons.

@edda
Copy link
Collaborator

edda commented May 11, 2023

Regarding the last issue (public/ folder gets emptied). This was a regression in the esbuild.config of the example app. It's fixed in this commit: fcf3da5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants