-
Notifications
You must be signed in to change notification settings - Fork 508
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
Error while building a docker image #824
Comments
+1 |
I have the same problem |
+1 |
Please do not copy Use a |
Did anyone solve this problem? |
Adding node_modules to .dockerignore solved this. |
docker is not detecting changes in the layers above "run npm ..." therefore it does not build the complete image. I solved it by exchanging run position with copy |
I've just had the same issue. the thing is there are two ways to solve the problem, the simplest one is to install bcryptjs instead of bcrypt As for the solution for bcrypt (in my case)
and the part of docker-compose.yml Mind WORKDIR, volumes, double check your paths
So I did a mistake in - '/app/node_modules' |
Create a |
I have the same problem |
Well, actually you should Create a Volumes:
after several attempts, I have realized that it is not necessary to add a script to remove bcrypt and then install it. |
I found the same issue, and learned in this article by Richard Kotze that this dependency needs to be build in the OS where is running. So, basically in your dockerfile, after doing |
Adding Only solution that did work is to rebuild bcrypt like this:
|
Switching to |
make .dockerignore and add /node_modules works for me |
My current problem is, if you use Next.js Standalone Output, you need to copy node_modules. Because they are not reinstalled so as not to add 700mb extra to the Docker image. |
+1 |
The package has not been maintained for 6 years, I am unsure if I should choose this over a package that is more up to date. |
I worked for me |
this is yet another solution that worked for me when using a docker-compose file: volumes:
- /app/node_modules |
Adding node_modules to .dockerignore works for me also. |
me too, adding docker ignore and volume to docker compose |
Adding node_modules to .dockerignore solved this. |
It works for me! |
adding node_modules/ .dockerignore file is worked for me , Happy coding !! |
adding node_modules/ .dockerignore file and remove node_modules volume worked for me ! thank you very much |
this is the log :
Error: Error loading shared library /home/node/app/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node: Exec format error
at Object.Module._extensions..node (internal/modules/cjs/loader.js:1206:18)
at Module.load (internal/modules/cjs/loader.js:1000:32)
at Function.Module._load (internal/modules/cjs/loader.js:899:14)
at Module.require (internal/modules/cjs/loader.js:1042:19)
at Module.Hook._require.Module.require (/usr/local/lib/node_modules/pm2/node_modules/require-in-the-middle/index.js:80:39)
at require (internal/modules/cjs/helpers.js:77:18)
at Object. (/home/node/app/node_modules/bcrypt/bcrypt.js:6:16)
at Module._compile (internal/modules/cjs/loader.js:1156:30)
at Module._extensions..js (internal/modules/cjs/loader.js:1176:10)
at Object.require.extensions. [as .js] (/home/node/app/node_modules/babel-register/lib/node.js:152:7)
at Module.load (internal/modules/cjs/loader.js:1000:32)
at Function.Module._load (internal/modules/cjs/loader.js:899:14)
at Module.require (internal/modules/cjs/loader.js:1042:19)
at Module.Hook._require.Module.require (/usr/local/lib/node_modules/pm2/node_modules/require-in-the-middle/index.js:80:39)
at require (internal/modules/cjs/helpers.js:77:18)
at Object. (/home/node/app/utils/auth.js:2:16)
2020-08-19T12:52:14: PM2 log: App [access-backend:0] exited with code [1] via signal [SIGINT]
2020-08-19T12:52:16: PM2 log: [Watch] Stop watching access-backend
2020-08-19T12:52:16: PM2 log: PM2 successfully stopped
DockerFile
FROM keymetrics/pm2:12-alpine
RUN mkdir -p /app
WORKDIR /app
ARG NODE_ENV
ENV NODE_ENV $NODE_ENV
COPY package*.json ./
RUN npm cache clean --force && rm -rf node_modules && npm install
EXPOSE 7777
CMD [ "pm2-runtime", "start", "ecosystem.config.js" ]
The text was updated successfully, but these errors were encountered: