Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/docker/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs 如何在Dockerfile中运行bower安装?_Angularjs_Docker_Docker Compose_Dockerfile - Fatal编程技术网

Angularjs 如何在Dockerfile中运行bower安装?

Angularjs 如何在Dockerfile中运行bower安装?,angularjs,docker,docker-compose,dockerfile,Angularjs,Docker,Docker Compose,Dockerfile,我使用go作为后端,angular js作为应用程序的前端,为了能够运行前端,我应该先运行bower install 注意:我正在从centos7基础映像构建映像 我尝试将其添加到RUN命令的docker文件中,如下所示 WORDIR ./Frontend RUN bower install 我有一个错误: /bin/sh: bower: command not found 有人知道我怎么解决这个问题吗?你应该看看 我明白了,除其他外 RUN apt-get install -y -qq n

我使用go作为后端,angular js作为应用程序的前端,为了能够运行前端,我应该先运行bower install

注意:我正在从centos7基础映像构建映像

我尝试将其添加到RUN命令的docker文件中,如下所示

WORDIR ./Frontend
RUN bower install
我有一个错误:

/bin/sh: bower: command not found

有人知道我怎么解决这个问题吗?

你应该看看

我明白了,除其他外

RUN apt-get install -y -qq npm

RUN ln -s /usr/bin/nodejs /usr/bin/node

# install bower

RUN npm install --global bower

首先,您需要检查bower是否安装在您的机器中。? 您可以使用bower安装软件包

您可以使用以下命令安装:
npm安装bower-g

这是如何使用centos为docker安装bower的完整示例

Dockerfile

在docker图像的构建阶段,您应该看到如下内容。它表明(在构建阶段)您成功安装了bower

尝试更改帮助以安装并添加docker命令-
WORDIR./Frontend

Step 8 : RUN bower help
---> Running in 2afd81510166
Usage:
bower <command> [<args>] [<options>]
Commands:
cache                   Manage bower cache
help                    Display help information about Bower
home                    Opens a package homepage into your favorite browser
步骤8:运行bower帮助
--->在2afd81510166中运行
用法:
鲍尔[][]
命令:
缓存管理bower缓存
帮助显示有关Bower的帮助信息
主页将在您喜爱的浏览器中打开软件包主页

您的docker中似乎没有安装
bower
image@Rudis是的,但是如果我使用centos7基本映像,我如何安装它?如何在centos7上安装bower在“谢谢”中有描述。我是从centos7基本映像创建映像的,但我没有安装apt,因此我无法找到apt get命令。你知道我该怎么做吗?如果你不知道centos,就用ubuntu作为基本镜像吧!Centos使用“yum”作为“apt get”,应该可以类似地工作。
Step 8 : RUN bower help
---> Running in 2afd81510166
Usage:
bower <command> [<args>] [<options>]
Commands:
cache                   Manage bower cache
help                    Display help information about Bower
home                    Opens a package homepage into your favorite browser