anthdm / superkit

MIT License
1k stars 84 forks source link

make build fails #24

Open gedw99 opened 3 months ago

gedw99 commented 3 months ago

on Mac..

  1. bootstrap to "gedw99" and cd into it.

  2. make dev, works fine : http://localhost:7331

  3. make build, failed with:


make build
make[1]: Entering directory '/Users/apple/workspace/go/src/github.com/superkit/gedw99'

Rebuilding...
(node:79932) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use `node --trace-warnings ...` to show where the warning was created)
Error: Cannot find module 'tailwindcss/defaultTheme'
Require stack:
- /Users/apple/workspace/go/src/github.com/superkit/gedw99/tailwind.config.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1212:15)
    at Function.resolve (node:internal/modules/helpers:133:19)
    at _resolve (/Users/apple/.npm/_npx/bc7494899bbce1ca/node_modules/jiti/dist/jiti.js:1:251148)
    at jiti (/Users/apple/.npm/_npx/bc7494899bbce1ca/node_modules/jiti/dist/jiti.js:1:253746)
    at /Users/apple/workspace/go/src/github.com/superkit/gedw99/tailwind.config.js:1:96
    at evalModule (/Users/apple/.npm/_npx/bc7494899bbce1ca/node_modules/jiti/dist/jiti.js:1:256443)
    at jiti (/Users/apple/.npm/_npx/bc7494899bbce1ca/node_modules/jiti/dist/jiti.js:1:254371)
    at /Users/apple/.npm/_npx/bc7494899bbce1ca/node_modules/tailwindcss/lib/lib/load-config.js:52:30
    at loadConfig (/Users/apple/.npm/_npx/bc7494899bbce1ca/node_modules/tailwindcss/lib/lib/load-config.js:54:6)
    at Object.loadConfig (/Users/apple/.npm/_npx/bc7494899bbce1ca/node_modules/tailwindcss/lib/cli/build/plugin.js:135:49) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/apple/workspace/go/src/github.com/superkit/gedw99/tailwind.config.js'
  ]
}
make[1]: *** [Makefile:64: build] Error 1

The fix for me was to add an "@npm install" and so its becomes:

build:
    @npm install
    @npx tailwindcss -i app/assets/app.css -o ./public/assets/styles.css
    @npx esbuild app/assets/index.js --bundle --outdir=public/assets
    @go build -o bin/app_prod cmd/app/main.go
    @echo "compiled you application with all its assets to a single binary => bin/app_prod"
anthdm commented 3 months ago

Aha thanks for pointing out!

damione1 commented 3 months ago

I'm almost to the end of a project using Superkit, and I'm wondering: What is your habitual strategy/ go-to way for deploying single binary Golang projects?

Did you embed them in a docker and mount a folder for the DB? Or in a Kubernetes ? Have you tried KO?

gedw99 commented 3 months ago

I use fly.io these days.

you embed in a docker and fly runs the docker.

I used to use KO and google cloud.