Shopify / shopify-app-template-node

MIT License
860 stars 393 forks source link

missing script "build" #1311

Open madelacerda opened 7 months ago

madelacerda commented 7 months ago

hello all!

i just downlaoded this template to work on a node project for shopify but when im trying to build the docker image to deploy this project into our services on AWS, im getting the error that there is no script for the build command inside my package. and after checking the package inside the front there is no build command, so why the dockerfile uses that command on the line: RUN cd frontend && npm install && npm run build?

// Paste any relevant logs here
1.907 npm ERR! Missing script: "build"
1.907 npm ERR!
1.908 npm ERR! To see a list of scripts, run:
1.908 npm ERR!   npm run
1.910
1.910 npm ERR! A complete log of this run can be found in: /root/.npm/_logs/2023-12-13T20_37_53_347Z-debug-0.log
------
Dockerfile:9
--------------------
   7 |     COPY web .
   8 |     RUN npm install
   9 | >>> RUN cd frontend && npm install && npm run build
  10 |     CMD ["npm", "run", "serve"]
  11 |
--------------------
ERROR: failed to solve: process "/bin/sh -c cd frontend && npm install && npm run build" did not complete successfully: exit code: 1

Expected behavior

build the docker image

Actual behavior

error on building image

Steps to reproduce the problem

  1. run docker build
matteodepalo commented 7 months ago

Hi @madelacerda, what is the content of package.json inside frontend?

madelacerda commented 7 months ago

Hi @matteodepalo ! my package.json looks like this: { "name": "shopify-app-template-node", "version": "1.0.0", "private": true, "license": "UNLICENSED", "scripts": { "debug": "node --inspect-brk index.js", "dev": "cross-env NODE_ENV=development nodemon index.js --ignore ./frontend", "serve": "cross-env NODE_ENV=production node index.js" }, "type": "module", "engines": { "node": ">=14.13.1" }, "dependencies": { "@shopify/shopify-app-express": "^2.1.3", "@shopify/shopify-app-session-storage-sqlite": "^1.2.3", "compression": "^1.7.4", "cross-env": "^7.0.3", "serve-static": "^1.14.1" }, "devDependencies": { "nodemon": "^2.0.15", "prettier": "^2.6.2", "pretty-quick": "^3.1.3" } }

matteodepalo commented 7 months ago

That seems to be the package.json inside web, but what about web/frontend? I see in the Dockerfile we copy web in . so frontend should become something you can cd into.

madelacerda commented 7 months ago

That seems to be the package.json inside web, but what about web/frontend? I see in the Dockerfile we copy web in . so frontend should become something you can cd into.

inside my web frontend there is no package, i just added there a index.html with an iframe, i just wanna build the docker image for this node project so we can deploy it in AWS, but im having this issue with the dockerfile. because right now i have 2 package.json one on the root of the project and the one insisde web

matteodepalo commented 7 months ago

What about trying to change the Dockerfile to not cd into frontend and simply call build at the top level?