Docker npm安装失败

时间:2016-03-11 22:28:32

标签: node.js docker npm npm-install

我正在尝试使用Docker构建一个ASP.Net 5.0 Web应用程序,但是当它到达npm安装步骤时失败,其中包含:

Step 14 : RUN npm install
 ---> Running in 15c191d1ca1d
npm WARN deprecated gulp-karma@0.0.4: Please use Karma directly: https://github.com/karma-runner/gulp-karma
npm WARN deprecated graceful-fs@3.0.8: graceful-fs version 3 and before will fail on newer node releases. Please update to graceful-fs@^4.0.0 as soon as possible.
npm WARN deprecated lodash@1.0.2: lodash@<3.0.0 is no longer maintained. Upgrade to lodash@^4.0.0.
npm WARN deprecated graceful-fs@1.2.3: graceful-fs version 3 and before will fail on newer node releases. Please update to graceful-fs@^4.0.0 as soon as possible.
npm WARN deprecated graceful-fs@2.0.3: graceful-fs version 3 and before will fail on newer node releases. Please update to graceful-fs@^4.0.0 as soon as possible.
npm WARN deprecated npmconf@2.1.2: this package has been reintegrated into npm and is now out of date with respect to npm
npm WARN prefer global typescript@1.5.3 should be installed with -g
npm WARN prefer global node-gyp@3.3.1 should be installed with -g

> node-sass@3.4.2 install /app/src/CDWebDesigner/node_modules/node-sass
> node scripts/install.js

Binary downloaded and installed at /app/src/CDWebDesigner/node_modules/node-sass/vendor/linux-x64-11/binding.node

> spawn-sync@1.0.15 postinstall /app/src/CDWebDesigner/node_modules/spawn-sync
> node postinstall

Installing native dependencies (this may take up to a minute)

> node-sass@3.4.2 postinstall /app/src/CDWebDesigner/node_modules/node-sass
> node scripts/build.js



The command 'npm install' returned a non-zero code: 1

ERROR: Build failed with: exit status 1

我在这里看不到任何错误,这些错误解释了它失败的原因,只有WARNings。我认为这必须是npm安装的问题或它试图安装的模块。 loadash@1.0.2表示它会在较新的npm安装上失败,但我不知道如何更新它,或者哪个依赖项正在将其拉入。

Dockerfile

FROM microsoft/aspnet:1.0.0-rc1-final

RUN apt-get update && apt-get install -y curl
RUN curl -sL https://deb.nodesource.com/setup | bash -
RUN apt-get install -y nodejs
RUN apt-get install bzip2

RUN curl -L https://npmjs.org/install.sh | sh

# Install bower
RUN npm install -g bower

# Install Gulp
RUN npm install -g gulp

# Install Git (for bower)
RUN apt-get -y install git

COPY . /app
WORKDIR /app
RUN ["dnu", "restore"]

WORKDIR ./src/myapp

RUN ["npm", "install"]
RUN ["bower", "install", "--allow-root"]
RUN ["gulp", "prod"]

EXPOSE 5000
CMD dnx kestrel

的package.json

{
  "name": "ASP.NET",
  "version": "0.0.0",
  "devDependencies": {
    "gulp": "3.8.11",
    "gulp-concat": "2.5.2",
    "gulp-cssmin": "0.1.7",
    "gulp-uglify": "1.2.0",
    "del": "^2.2.0",
    "gulp-sass": "^2.0.4",
    "gulp-typescript": "~2.8.0",
    "main-bower-files": "~2.9.0",
    "gulp-sourcemaps": "~1.5.2",
    "mocha": "~2.2.5",
    "gulp-mocha": "~2.1.3",
    "karma-chai": "~0.1.0",
    "chai": "~3.2.0",
    "karma": "~0.13.9",
    "karma-jasmine": "~0.3.6",
    "karma-phantomjs-launcher": "~0.2.1",
    "karma-spec-reporter": "~0.0.20",
    "gulp-karma": "^0.0.4",
    "gulp-js-obfuscator": "~1.0.0",
    "gulp-order": "^1.1.1",
    "gulp-debug": "^2.1.2"
  }
}

1 个答案:

答案 0 :(得分:6)

不确定,但是第一:你可以尝试使用sudo npm install进行安装,第二步你可以尝试在这台机器上安装node-gyp和pyton 2.7。如果安装期间的模块需要编译节点扩展,那么您将需要这两件事。

第三。我们通常如何调试:在失败命令之前在状态上创建映像。使用交互式shell运行容器(使用-it)。登录里面。并且手动运行npm install。在那里查看并了解输出。固定。