3

I am trying to deploy my angularjs app into a docker container:

myapp/web/Dockerfile

FROM node:latest

RUN mkdir /myapp
ADD . /myapp
WORKDIR /myapp

RUN npm install -g phantomjs-prebuilt
RUN npm install -g grunt-cli
RUN npm install -g grunt
RUN npm install -g bower

RUN npm install
RUN bower install --allow-root
RUN npm run v2

EXPOSE 9000

CMD ["grunt", "serve"]

myapp/docker-compose.yml

version: '2'
services:
  nginx-proxy:
    image: jwilder/nginx-proxy
    container_name: nginx-proxy
    ports:
      - "80:80"
    volumes:
      - /var/run/docker.sock:/tmp/docker.sock:ro

  web:
    build: ./web
    image: myapp/web
    environment:
      - VIRTUAL_HOST=myapp.dev

Outputs

> [email protected] install /usr/local/lib/node_modules/phantomjs-prebuilt
> node install.js

Considering PhantomJS found at /usr/local/bin/phantomjs
Looks like an `npm install -g`
Could not link global install, skipping...
Downloading https://github.com/Medium/phantomjs/releases/download/v2.1.1/phantomjs-2.1.1-linux-x86_64.tar.bz2
Saving to /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2
Receiving...

Received 22866K total.
Extracting tar contents (via spawned process)
Removing /usr/local/lib/node_modules/phantomjs-prebuilt/lib/phantom
Copying extracted folder /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2-extract-1497270232242/phantomjs-2.1.1-linux-x86_64 -> /usr/ local/lib/node_modules/phantomjs-prebuilt/lib/phantom
Phantom installation failed { Error: EACCES: permission denied, link '/tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2-extract-149727 0232242/phantomjs-2.1.1-linux-x86_64' -> '/usr/local/lib/node_modules/phantomjs-prebuilt/lib/phantom'
  errno: -13,
  code: 'EACCES',
  syscall: 'link',
  path: '/tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2-extract-1497270232242/phantomjs-2.1.1-linux-x86_64',
  dest: '/usr/local/lib/node_modules/phantomjs-prebuilt/lib/phantom' } Error: EACCES: permission denied, link '/tmp/phantomjs/phantomjs- 2.1.1-linux-x86_64.tar.bz2-extract-1497270232242/phantomjs-2.1.1-linux-x86_64' -> '/usr/local/lib/node_modules/phantomjs-prebuilt/lib/ph antom'
npm info lifecycle [email protected]~install: Failed to exec install script
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2017-06-12T12_23_56_471Z-debug.log

I tried to add USER root before the global npm install but nothing changes.

Any help apreciated

9
  • run with sudo user Commented Jun 12, 2017 at 12:55
  • tried and I get the same result Commented Jun 12, 2017 at 13:16
  • sudo npm install Commented Jun 12, 2017 at 13:19
  • sudo command not found Commented Jun 12, 2017 at 13:55
  • @kitensei - could you share detailed logs at /root/.npm/_logs/2017-06-12T12_23_56_471Z-debug.log? Commented Jun 12, 2017 at 19:31

1 Answer 1

1

I have the same issue, and this works for me.

sudo npm install -g [email protected] --unsafe-perm

https://github.com/Medium/phantomjs/issues/707#issuecomment-320989493

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.