windows – 构建docker镜像时无法npm安装依赖项
发布时间:2020-12-14 01:57:21 所属栏目:Windows 来源:网络整理
导读:我正在构建一个Dockerfile中的图像,并且我构建映像时我的npm安装依赖项的部分是错误的,但我可以在它之外运行命令.我不确切地知道这个错误的来源. 我在Windows上使用boot2docker,我的Dockerfile是: FROM ubuntu:15.04RUN apt-get -y update RUN apt-get -y i
我正在构建一个Dockerfile中的图像,并且我构建映像时我的npm安装依赖项的部分是错误的,但我可以在它之外运行命令.我不确切地知道这个错误的来源.
我在Windows上使用boot2docker,我的Dockerfile是: FROM ubuntu:15.04 RUN apt-get -y update RUN apt-get -y install nodejs RUN apt-get -y install npm COPY /server /src COPY /server/package.json /tmp/package.json RUN cd /tmp && npm install (etc) 错误消息是: sh:1 node: not found npm WARN: This failure might be due to the use of legacy binary "node" npm WARN: For further explanations,please read /usr/share/doc/nodejs/README.Debian npm ERR! sails@0.11.0 preinstall: 'node ./lib/preinstall_npmcheck.js' npm ERR! Exit status 127 npm ERR! npm ERR! Failed at the sails@0.11.0 preinstall script. npm ERR! This is most likely a problem iwth the sails package,npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! node ./lib/preinstall_npmcheck.js npm ERR! You can get their info via: npm ERR! npm owner ls sails npm ERR! There is additional logging output above. npm ERR! System Linux 4.0.3-boot2docker npm ERR! command "usr/bin/nodejs" "/usr/bin/npm" "install" npm ERR! node -v v0.10.25 npm ERR! npm -v 1.4.21 npm ERR! code ELIFECYCLE npm ERR! npm ERR! Additional logging details can be found in: npm ERR! /tmp/npm-debug.log npm ERR! not ok code 0 INFO[0633] THe command [/bin/sh -c cd /tmp && install] returned a non-zero code: 1 虽然它说它可能是Sails的问题,但我在我的机器上安装它没有问题.当我运行图像时(显然)我无法安装它,当我尝试运行ubuntu:15.04图像并在那里安装npm和Sails时,它告诉我npm是一个未找到的命令. 我还是Docker的新手(对Windows–我甚至找不到npm-debug.log)所以任何类型的建议都有很大帮助. 谢谢! 解决方法
这是nodejs安装的问题,这里有一个问题:
what are the differences between node.js and node?
很明显,有三种方法可以解决这个问题:自己创建符号链接,使用nvm,或者安装nodejs-legacy而不是nodejs: 运行apt-get -y安装nodejs-legacy (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
推荐文章
站长推荐
- windows – 调查内存泄漏
- .net-3.5 – Win 2008 r2 x64服??务器是否已安装
- Microsoft是否提供连接到其自己的MS CryptoAPI的
- Windows Mobile – 如何让Windows Mobile设备中心
- windows-7 – 通过SSH到Windows 7的远程桌面框
- windows-server-2008-r2 – 仅限rdp访问某个IP
- 如何设置subgit镜像一个看起来像Windows资源管理
- 用户可以在Windows网络浏览器中查看Active Direc
- 使用Exchange命令创建分发列表时限制别名的复制
- Windows 视频Directshow开发介绍
热点阅读