简体   繁体   English

无法用文件替换到目录 /var/lib/docker/overlay2/if2ip5okvavl8u6jpdtpczuog/merged/app/node_modules/@ampproject/remapping

[英]cannot replace to directory /var/lib/docker/overlay2/if2ip5okvavl8u6jpdtpczuog/merged/app/node_modules/@ampproject/remapping with file

On my Windows machine, I am attempting to build a containerized node.js application with the following Dockerfile:在我的 Windows 机器上,我正在尝试使用以下 Dockerfile 构建容器化的 node.js 应用程序:

  # use latest version of nodejs
  FROM node:lts-alpine
  
  # install aurelia-cli to build the app & http-server to serve static contents
  RUN npm i -g http-server
  RUN npm i -g aurelia-cli
  
  # set working directory to app
  # henceforth all commands will run inside this folder
  WORKDIR /app
  
  # copy package.json related files first and install all required dependencies
  COPY package*.json ./
  RUN npm install
  
  # copy the rest of the files and folders & install dependencies
  COPY . ./
  RUN npm run build
  
  # by default http-server will serve contents on port 8080
  # so we expose this port to host machine
  EXPOSE 8080
  
  CMD [ "http-server" , "dist" ]

However, docker build .但是, docker build . fails at the line Copy . ./Copy . ./ Copy . ./ . Copy . ./ . with the message cannot replace to directory /var/lib/docker/overlay2/if2ip5okvavl8u6jpdtpczuog/merged/app/node_modules/@ampproject/remapping with file .消息cannot replace to directory /var/lib/docker/overlay2/if2ip5okvavl8u6jpdtpczuog/merged/app/node_modules/@ampproject/remapping with file

What do I need to do to get my container image to build?我需要做什么来构建我的容器映像?

Add node_modules to a .dockerignore file in the same directory as your Dockerfile, as outlined here : (h/t David Maze ).node_modules添加到与 Dockerfile 位于同一目录中的.dockerignore文件中如下所述:(h/t David Maze )。

Less gracefully, simply delete the project's node_modules directory then rerun docker build .不太优雅,只需删除项目的node_modules目录,然后重新运行 docker docker build

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 错误:ENOENT,没有这样的文件或目录'/ usr / lib / nodejs:/ usr / lib / node_modules:/ usr / share / javascript / app / models - Error: ENOENT, no such file or directory '/usr/lib/nodejs:/usr/lib/node_modules:/usr/share/javascript/app/models Angular:bash: /usr/local/lib/node_modules/@angular/cli/bin/ng: 没有这样的文件或目录 - Angular:bash: /usr/local/lib/node_modules/@angular/cli/bin/ng: No such file or directory Docker运行错误-> EEXIST:文件已经存在,符号链接'/ app / node_modules'->'/app/.build/node_modules' - Docker run error -> EEXIST: file already exists, symlink '/app/node_modules' -> '/app/.build/node_modules' 节点在dockerized node app中找不到node_modules - Node cannot find node_modules in dockerized node app 无法加载我手动放在/ node_modules /目录中的模块 - Cannot load module I put manually in /node_modules/ directory 错误:ENOENT:没有那个文件或目录,打开 C:\\myangularproject\\src\\node_modules\\nlcst-pattern-match\\lib\\index.js - Error: ENOENT: no such file or directory, open C:\myangularproject\src\node_modules\nlcst-pattern-match\lib\index.js 不同目录中的node_modules - node_modules in a different directory 缩小 node_modules 目录? - Shrink node_modules directory? fork/exec./node_modules/.bin/solcjs:没有这样的文件或目录 - fork/exec ./node_modules/.bin/solcjs: no such file or directory 使用 docker 构建 angular 应用程序时的 node_modules 卷技巧 - The node_modules Volume Trick when building an angular app with docker
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM