Docker npm install fails
Not sure, but 1st: you can try install with sudo npm install, and 2nd you can try to install on this machine node-gyp and pyton 2.7 . If module during installation require compilation of node extension, then you will need these two things.
3rd. How we usually debug: Create an image on the state before failing command. run container with interactive shell (with -it). login inside. And run npm install by hands. See and understand output there. Fix.
user882807
Updated on March 12, 2020Comments
-
user882807 about 4 years
I'm trying to build an ASP.Net 5.0 web app using Docker, but it fails when it reaches the npm install step, with:
Step 14 : RUN npm install ---> Running in 15c191d1ca1d npm WARN deprecated [email protected]: Please use Karma directly: https://github.com/karma-runner/gulp-karma npm WARN deprecated [email protected]: 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 [email protected]: lodash@<3.0.0 is no longer maintained. Upgrade to lodash@^4.0.0. npm WARN deprecated [email protected]: 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 [email protected]: 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 [email protected]: this package has been reintegrated into npm and is now out of date with respect to npm npm WARN prefer global [email protected] should be installed with -g npm WARN prefer global [email protected] should be installed with -g > [email protected] 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 > [email protected] postinstall /app/src/CDWebDesigner/node_modules/spawn-sync > node postinstall Installing native dependencies (this may take up to a minute) > [email protected] 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
I can't see any errors here that explain why it's failing, only WARNings. I assume this must either be a problem with the npm installation or the modules it's trying to install. [email protected] says it will fail on newer npm installs, but I don't know how to update this, or which of the dependencies is pulling this in.
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" } }
-
user882807 about 8 yearsThanks. I built the image up to the failing command and ran npm install manually which gave more information about the errors - there were some conflicting dependencies.