【发布时间】:2019-02-21 16:57:48
【问题描述】:
我正在尝试通过 Docker 容器进行 npm 安装:
这是一个 DockerFile:
# default /var/www/html (mapped to .../code folder with projects)
FROM node
WORKDIR /work
# Additional tools (ng, gulp, bower)
RUN npm install -g @angular/cli bower gulp grunt
CMD while true; do sleep 10000; done
EXPOSE 3002 3003 3004
我用这个命令运行并映射它:
docker run -d --name node-cmd -p 3002:3002 -p 3003:3003 -p 3004:3004 -v
/m/dockerlogs/node-cmd/logs:/root/.npm/_logs -v /m/projekty:/work node-cmd
我登录到这个容器:
docker exec -it node-cmd bash -c "cd /code; bash"
在我运行 npm install (https://github.com/gdi2290/angular-starter) 之后,我从登录的容器中编写了这个
但安装后出现此错误
npm ERR! Maximum call stack size exceeded
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2018-09-17T17_38_34_855Z-debug.log
root@08e3cd77fb83:/work/angular-starter-master#
我试图删除node_modules,但这个问题总是。
有时,在出现此错误后,当我再次尝试 npm install 时,控制台会显示以下内容:
npm ERR! path /work/angular-starter-
master/node_modules/@schematics/update/packa
ge.json.2932816706
npm ERR! code ETXTBSY
npm ERR! errno -26
npm ERR! syscall rename
npm ERR! ETXTBSY: text file is busy, rename '/work/angular-starter-
master/node_m
odules/@schematics/update/package.json.2932816706' -> '/work/angular-
starter-mas
ter/node_modules/@schematics/update/package.json'
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2018-09-17T17_14_43_970Z-debug.log
root@08e3cd77fb83:/work/angular-starter-master#
我的 npm 版本是 6.4.1
我有一个 Windows 8.1 和 Docker 工具箱
但是当我在没有 Docker 的情况下在 Windows 上编写 npm install 时一切正常。
【问题讨论】:
-
你为什么一直循环播放?
CMD while true; do sleep 10000; done退出条件在哪里? -
@LukeHutton 这一行允许
docker exec“登录”到容器(如果你删除它,docker会在运行后迅速杀死容器) -
aw 好的,从未使用过该模式,但我确实看到它被使用了。
-
你能把节点更新到最新吗? v8.9.x 再试一次,在stackoverflow.com/questions/45678817/…上查看信息
-
@LukeHutton 现在控制台向我显示此错误:npm ERR!路径 ../typescript/bin/tsc npm 错误!代码 EPROTO npm 错误! errno -71 npm 错误!系统调用符号链接 npm ERR! EPROTO:协议错误,符号链接 '../typescript/bin/tsc' -> '/work/angul ar-starter-master/node_modules/@angular-devkit/build-optimizer/node_modules/.bin /tsc'