gpt4 book ai didi

angularjs - 将 AngularJS 应用程序部署到 docker 容器中

转载 作者:搜寻专家 更新时间:2023-10-31 23:58:53 26 4
gpt4 key购买 nike

我正在尝试将我的 angularjs 应用程序部署到 docker 容器中:

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

输出

> phantomjs-prebuilt@2.1.14 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 phantomjs-prebuilt@2.1.14~install: Failed to exec install script
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! phantomjs-prebuilt@2.1.14 install: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the phantomjs-prebuilt@2.1.14 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

我尝试在全局 npm 安装之前添加 USER root 但没有任何变化。

感谢任何帮助

最佳答案

我有同样的问题,这对我有用。


sudo npm install -g phantomjs@2.1.1 --unsafe-perm

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

关于angularjs - 将 AngularJS 应用程序部署到 docker 容器中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44499555/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com