0

I'm trying to npm install by Docker container:

This is a 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

I run and map it with this command:

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

I log in to this container with:

docker exec -it node-cmd bash -c "cd /code; bash"

After I run npm install (https://github.com/gdi2290/angular-starter), I write this from logged in container

But I'm getting this error after installation

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#

I was try to delete node_modules, but this problem is always.

Sometimes, after this error, when I again try npm install, console show me this:

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#

My npm version is 6.4.1

I have a Windows 8.1 and Docker Toolbox

But when I write npm install on Windows without Docker all is OK.

michal39
  • 9
  • 1
  • 5
  • why are you looping forever? ```CMD while true; do sleep 10000; done ``` where's the exit condition? – Luke Hutton Sep 17 '18 at 18:20
  • 1
    @LukeHutton this line allow to "login" to container by `docker exec` (if you delete it, docker will kill container quickly after run) – Kamil Kiełczewski Sep 17 '18 at 18:52
  • aw ok, never worked with that pattern, but i do see it is used. – Luke Hutton Sep 17 '18 at 19:02
  • 1
    Can you update node to latest? v8.9.x and try again, also checkout info on https://stackoverflow.com/questions/45678817/error-etxtbsy-text-file-is-busy-on-npm-install – Luke Hutton Sep 17 '18 at 19:04
  • @LukeHutton now console show me this error: npm ERR! path ../typescript/bin/tsc npm ERR! code EPROTO npm ERR! errno -71 npm ERR! syscall symlink npm ERR! EPROTO: protocol error, symlink '../typescript/bin/tsc' -> '/work/angul ar-starter-master/node_modules/@angular-devkit/build-optimizer/node_modules/.bin /tsc' – michal39 Sep 18 '18 at 16:17

3 Answers3

2

It might be because of different node versions. Check your node version with node -v and use that for the Dockerfile. Check the supported tags and Dockerfile links here: https://hub.docker.com/_/node

In the Dockerfile, I changed from FROM node:alpine AS node_builder to FROM node:lts-alpine AS node_builder and now it works.

  • Excelent! for me, the combination of `FROM node:lts-alpine` and `RUN npm install --no-bin-links` did the job! – Csorgo Nov 15 '20 at 19:02
0

Ok, i solved this problem, I was use npm install with --no-bin-links flag. Thanks for answers :)

michal39
  • 9
  • 1
  • 5
0

For me, this ended up being caused by permission issues (I had previously install node_modules outside of docker). Deleting node_modules and only installing from within docker corrected the problem.

lightswitch05
  • 9,058
  • 7
  • 52
  • 75