Reputation: 431
Node Version that my docker image has = v12.3.0
NPM version = 6.9.0
below is the package.json
file, which lists all the dependencies for the app.
{
..
},
"private": true,
"dependencies": {
"@agm/core": "1.0.0-beta.5",
"@angular/animations": "7.2.1",
"@angular/cdk": "7.2.1",
"@angular/common": "7.2.1",
"@angular/compiler": "7.2.1",
"@angular/core": "7.2.1",
"@angular/flex-layout": "7.0.0-beta.23",
"@angular/forms": "7.2.1",
"@angular/http": "7.2.1",
"@angular/material": "7.2.1",
"@angular/material-moment-adapter": "7.2.1",
"@angular/platform-browser": "7.2.1",
"@angular/platform-browser-dynamic": "7.2.1",
"@angular/router": "7.2.1",
"@ngrx/effects": "7.1.0",
"@ngrx/router-store": "7.1.0",
"@ngrx/store": "7.1.0",
"@ngrx/store-devtools": "7.1.0",
"@ngx-translate/core": "11.0.1",
"@swimlane/dragula": "3.7.3",
"@swimlane/ngx-charts": "10.0.0",
"@swimlane/ngx-datatable": "14.0.0",
"@swimlane/ngx-dnd": "6.0.0",
"@types/prismjs": "1.9.0",
"angular-calendar": "0.26.4",
"angular-in-memory-web-api": "0.8.0",
"chart.js": "2.7.3",
"ci": "1.0.0",
"classlist.js": "1.1.20150312",
"core-js": "2.6.2",
"d3": "5.7.0",
"date-fns": "1.30.1",
"hammerjs": "2.0.8",
"html2canvas": "1.0.0-alpha.12",
"jspdf": "1.5.3",
"jwt-decode": "2.2.0",
"lodash": "4.17.11",
"moment": "2.24.0",
"ng2-charts": "1.6.0",
"ngrx-store-freeze": "0.2.4",
"ngx-clipboard": "11.1.9",
"ngx-color-picker": "7.3.0",
"ngx-cookie-service": "2.1.0",
"ngx-quill": "4.5.0",
"ngx-socket-io": "2.1.1",
"perfect-scrollbar": "1.4.0",
"prismjs": "1.15.0",
"rxjs": "6.3.3",
"rxjs-compat": "6.3.3",
"tslib": "^1.9.3",
"web-animations-js": "2.3.1",
"zone.js": "0.8.28"
},
"devDependencies": {
"@angular-devkit/build-angular": "0.13.8",
"@angular/cli": "7.2.2",
"@angular/compiler-cli": "7.2.13",
"@angular/language-service": "7.2.1",
"@angularclass/hmr": "2.1.3",
"@types/googlemaps": "3.30.19",
"@types/jasmine": "3.3.7",
"@types/jasminewd2": "2.0.6",
"@types/lodash": "4.14.120",
"@types/node": "10.12.18",
"codelyzer": "4.5.0",
"jasmine-core": "3.3.0",
"jasmine-spec-reporter": "4.2.1",
"karma": "3.1.4",
"karma-chrome-launcher": "2.2.0",
"karma-coverage-istanbul-reporter": "2.0.4",
"karma-jasmine": "2.0.1",
"karma-jasmine-html-reporter": "1.4.0",
"node-sass": "4.11.0",
"protractor": "5.4.2",
"quill": "1.3.6",
"ts-node": "8.0.1",
"tslint": "5.12.1",
"typescript": "3.2.4",
"webpack-bundle-analyzer": "3.0.3"
}
}
Dockerfile
FROM node as builder
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
COPY package*.json /usr/src/app/
RUN npm install
COPY . /usr/src/app
RUN npm run-script build
when it reaches this command: RUN npm install
after compiling for a while, it throws this error:
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall 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/2019-05-24T06_30_43_945Z-debug.log
what do I need to do to get it work??
more from same error..
In file included from ../../nan/nan.h:53:0,
from ../src/binding.cpp:1:
/root/.node-gyp/12.3.0/include/node/node.h:107:24: fatal error: util-inl.h: No such file or directory
# include <util-inl.h>
^
as far as I understand, it should resolve all dependencies via npm install, but it seems it can't.. I'm sure the file package.json file is in the same dir as my working dir in Dockerfile..
Upvotes: 1
Views: 914
Reputation: 11474
In case you want to use Node 11 (and supposedly above), there’s the following issue:
Angular CLI: 7.0.3 Cannot find module 'node-sass'
I suggested in the comments to update the node-sass
dependency (or add it as explicit dependency, if it’s not listed already). This fixed the issue for me.
Alternatively (and probably cleaner), it should help if you update the dependency @angular-devkit/build-angular
(this is the one which contains node-sass
) to a current version -- for me using ^0.13.9
solved the issue with Node 11.
Anyways, I’d suggest:
Dockerfile
Upvotes: 0
Reputation: 4959
Your reported issue is possibly related to the use of node
latest version. I would recommend to stick to the the latest LTS
version(stable), which is currently 10.15.3
.
Running npm i
with a minimum package.json
(obviously including the part with the dependencies you provided) finished successfully on my host machine(windows10) and on a docker container.
This is my Dockerfile
:
FROM node:10.15.3-alpine
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
#it seems git is required for the build process
RUN apk add git
COPY package*.json /usr/src/app/
RUN npm i
If you still facing issues then something is wrong with angular application.
Upvotes: 2