google / closure-compiler-npm

Package for managing and documenting closure-compiler for use via npm

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

exited with 127 errror when building docker image

antotoki opened this issue · comments

I'm getting the following error when I try to build docker image:

"ERROR: "prod" exited with 127."

Command to build docker image:

docker build -t Dashboard -f Dockerfile ../../

Here's how my Dockerfile looks like and as you can see, it is pretty straightforward:

FROM node:16.14.0-alpine as script
WORKDIR /src
COPY ["spa/Javascript-Script-v.2.0/","spa/Javascript-Script-v.2.0/"]  
WORKDIR "/src/spa/Javascript-Script-v.2.0"
RUN npm install
RUN npm run build

package.json:

{
  "name": "javascript-script-v.2.0",
  "version": "2.0.0",
  "description": "",
  "main": "./src/script.js",
  "scripts": {
    "build": "npm-run-all prepare prod clean",
    "prepare": "grunt build",
    "prod": "npx google-closure-compiler --js=./src/source.js --js_output_file=./dist/script.js",
    "clean": "grunt cleanup"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "google-closure-compiler": "20221102.0.1",
    "grunt": "^1.0.4",
    "grunt-contrib-clean": "^2.0.0",
    "grunt-contrib-concat": "^1.0.1",
    "grunt-include-replace": "^5.0.0",
    "grunt-wrap": "^0.3.1",
    "npm-run-all": "^4.1.5"
  },
  "dependencies": {
    "JSON2": "^0.1.0",
    "crypto-js": "^4.0.0"
  }
}

When I try to run npm run build directly on my windows machine, everything works like a charm.

To get better logging, I would recommend invoking the compiler directly from the DOCKERFILE rather than wrapping it with an NPM script. Try RUN npx google-closure-compiler --js=./src/source.js --js_output_file=./dist/script.js and see what happens.

Normally issues like this have to do with the container OS or permissions.

Thank you for your reply.

I did exactly what you suggested but didn't get any useful info from the logging.

 => ERROR [script 7/8] RUN npx google-closure-compiler  --js=./src/source.js  --js_output_file=./dist/script.js                                                                                                                 2.0s
------
 > [script 7/8] RUN npx google-closure-compiler  --js=./src/source.js  --js_output_file=./dist/script.js:
------
executor failed running [/bin/sh -c npx google-closure-compiler  --js=./src/source.js  --js_output_file=./dist/script.js]: exit code: 127

Google says that exit code: 127 indicates command not found but not sure what is root cause of this problem.

Can you make sure that npx itself is installed and working in the docker container? Try some other package and show that functioning.

Please find the screenshot below as a proof that npx itself works fine in the docker container.

image

This may be related to #280.

I'm closing this issue for lack of activity.