Bcrypt: invalid ELF header with Docker and Sails.JS

后端 未结 7 1969
被撕碎了的回忆
被撕碎了的回忆 2021-01-02 02:41

My Node Dockfile:

# Set the base image to ubuntu
FROM ubuntu

# Define working directory
ADD . /src
WORKDIR /src

# Install Node.js & other          


        
7条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-02 03:12

    There is a simple way that allowed me to solve this problem, I think this can helps you also in Docker, just add to the run instructions on you docker file this instructions

    1. Uninstall bcrypt

    npm uninstall bcrypt
    

    2.- Install bcrypt again

    npm i bcrypt
    

    Edit this part of your docker file adding the lines

    ADD package.json /src/package.json
    RUN cd /src && npm install
    
    
    #Solve the problem reinstaling bcrypt
    RUN npm uninstall bcrypt
    RUN npm i bcrypt
    
    
    # Expose port
    EXPOSE  8080
    

    The error occurs because when you install bcypt, npm installs the recommended version for your machine and operating system, but when you are on another machine, this doesn't work.

提交回复
热议问题