No access permission error with npm global install on docker image

前端 未结 5 1831
小鲜肉
小鲜肉 2021-01-31 09:19

I\'m trying to build a docker image with a global install of firebase-tools and angular-cli. I\'m building the same image for two versions of node: 6.x (LTS bor

5条回答
  •  悲&欢浪女
    2021-01-31 09:22

    I was able to get it working by changing the default npm-global directory.

    This is my dockerfile now:

    FROM node:latest
    USER node
    
    RUN mkdir /home/node/.npm-global
    ENV PATH=/home/node/.npm-global/bin:$PATH
    ENV NPM_CONFIG_PREFIX=/home/node/.npm-global
    
    RUN npm install --quiet --no-progress -g @angular/cli@latest firebase-tools
    RUN npm cache clean --force
    

提交回复
热议问题