Docker and npm - gyp ERR! not ok

后端 未结 1 2162
无人及你
无人及你 2021-02-19 10:44

Everything was working with my client until I tried to solve some Network disconnected issue by upgrading react-scripts in my docker client se

相关标签:
1条回答
  • 2021-02-19 11:42

    Add the following line to your client Dockerfile:

    RUN apk update && apk add python make g++
    

    So it should look like this:

    # base image
    FROM node:11.12.0-alpine
    
    RUN apk update && apk add python make g++
    
    # set working directory
    WORKDIR /usr/src/app
    
    # add `/usr/src/app/node_modules/.bin` to $PATH
    ENV PATH /usr/src/app/node_modules/.bin:$PATH
    
    # install and cache app dependencies
    COPY package.json /usr/src/app/package.json
    COPY package-lock.json /usr/src/app/package-lock.json
    RUN npm ci
    RUN npm install react-scripts@3.3.0 -g --silent
    
    # start app
    CMD ["npm", "start"]
    
    0 讨论(0)
提交回复
热议问题