So, I have one more question on how to install node.js structure in Docker on CoreOS, for this post .
So, since npm is subtle when installing from package.json root, I had to create a nonroot sudo user to install the package. This is what my Dockerfile currently looks inside our repo, creating an ubuntu image:
# Install dependencies and nodejs RUN apt-get update RUN apt-get install -y python-software-properties python g++ make RUN add-apt-repository ppa:chris-lea/node.js RUN apt-get update RUN apt-get install -y nodejs # Install git RUN apt-get install -y git # Bundle app source ADD . /src # Create a nonroot user, and switch to it RUN /usr/sbin/useradd --create-home --home-dir /usr/local/nonroot --shell /bin/bash nonroot RUN /usr/sbin/adduser nonroot sudo RUN chown -R nonroot /usr/local/ RUN chown -R nonroot /usr/lib/ RUN chown -R nonroot /usr/bin/ RUN chown -R nonroot /src USER nonroot # Install app source RUN cd /src; npm install
I know this is an inelegant way of doing something, but I don't understand how to complete the npm installation. When I try to do this, I get errors in all packages when they try to install:
Error: Attempt to unlock javascript-brunch@1.7.1, which hasn't been locked at unlock (/usr/lib/node_modules/npm/lib/cache.js:1304:11) at cb (/usr/lib/node_modules/npm/lib/cache.js:646:5) at /usr/lib/node_modules/npm/lib/cache.js:655:20 at /usr/lib/node_modules/npm/lib/cache.js:1282:20 at afterMkdir (/usr/lib/node_modules/npm/lib/cache.js:1013:14) at /usr/lib/node_modules/npm/node_modules/mkdirp/index.js:37:53 at Object.oncomplete (fs.js:107:15) If you need help, you may report this *entire* log, including the npm and node versions, at: <http://github.com/npm/npm/issues> ...
Any thoughts on how I can modify my Docker file? I can only assume that this is a definite problem with what I provided to the nonroot user above, which can be especially important for the Docker platform; I have no problem doing such things only when installing vanilla ubuntu, although not from the script.
fox
source share