0

I am facing this issue while building a Docker via Docker Cloud Building in

Docker Cloud's infrastructure...
Cloning into '.'...
Warning: Permanently added the RSA host key for IP address '104.192.143.1' to the list of known hosts.
Switched to a new branch 'development'
Pulling cache layers for index.docker.io/bheng/iproject-web:latest...
Done!
KernelVersion: 4.4.0-93-generic
Arch: amd64
BuildTime: 2017-08-17T22:50:04.828747906+00:00
ApiVersion: 1.30
Version: 17.06.1-ce
MinAPIVersion: 1.12
GitCommit: 874a737
Os: linux
GoVersion: go1.8.3
Starting build of index.docker.io/bheng/iproject-web:latest...
Step 1/16 : FROM node:9.3.0-alpine as builder
---> cee518159787
Step 2/16 : COPY package.json ./
---> 3d8915b22a32
Removing intermediate container a4c13040dd58
Step 3/16 : RUN npm set progress=false && npm config set depth 0 && npm cache clean --force
---> Running in 69b80d469997
npm WARN
using --force I sure hope you know what you are doing.
---> e450d98a30ee
Removing intermediate container 69b80d469997
Step 4/16 : RUN npm i
---> Running in 7c624872d8e3
> [email protected] install /node_modules/node-sass
> node scripts/install.js
Downloading binary from https://github.com/sass/node-sass/releases/download/v4.7.2/linux_musl-x64-59_binding.node
Download complete
Binary saved to /node_modules/node-sass/vendor/linux_musl-x64-59/binding.node
Caching binary to /root/.npm/node-sass/4.7.2/linux_musl-x64-59_binding.node
> [email protected] postinstall /node_modules/webpack/node_modules/uglifyjs-webpack-plugin
> node lib/post_install.js
> [email protected] postinstall /node_modules/node-sass
> node scripts/build.js
Binary found at /node_modules/node-sass/vendor/linux_musl-x64-59/binding.node
Testing binary
Binary is fine
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN @angular/[email protected] requires a peer of @angular/[email protected] but none is installed. You must install peer dependencies yourself.
npm WARN @ng-bootstrap/[email protected] requires a peer of @angular/core@^4.0.3 but none is installed. You must install peer dependencies yourself.
npm WARN @ng-bootstrap/[email protected] requires a peer of @angular/common@^4.0.3 but none is installed. You must install peer dependencies yourself.
npm WARN @ng-bootstrap/[email protected] requires a peer of @angular/forms@^4.0.3 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of @angular/common@^2.4.9 || ^4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of @angular/core@^2.4.9 || ^4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of @angular/http@^2.4.9 || ^4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of @angular/compiler@^2.3.1 || >=4.0.0-beta <5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of @angular/core@^2.3.1 || >=4.0.0-beta <5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @angular-devkit/[email protected] requires a peer of @angular-devkit/[email protected] but none is installed. You must install peer dependencies yourself.
npm WARN @schematics/[email protected] requires a peer of @angular-devkit/[email protected] but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
added 1202 packages in 203.011s
---> fd1a6cff70f6
Removing intermediate container 7c624872d8e3
Step 5/16 : RUN mkdir /web
---> Running in eac64ccf5c19
---> 206fdaf4ed7b
Removing intermediate container eac64ccf5c19
Step 6/16 : RUN cp -R ./node_modules ./web
---> Running in e36f620dd3fb
---> 7d9367fa1f9b
Removing intermediate container e36f620dd3fb
Step 7/16 : WORKDIR /web
---> 0f1b5d4d425b
Removing intermediate container 411e75479d64
Step 8/16 : COPY . .
---> e4e2743df0e0
Removing intermediate container 145a37f072ae
Step 9/16 : RUN $(npm bin)/ng build --prod --build-optimizer
---> Running in 491f4a13f415
module.js:557
throw err;
^
Error: Cannot find module '@angular-devkit/core'
at Function.Module._resolveFilename (module.js:555:15)
at Function.Module._load (module.js:482:25)
at Module.require (module.js:604:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/web/node_modules/@angular-devkit/schematics/src/tree/virtual.js:10:16)
at Module._compile (module.js:660:30)
at Object.Module._extensions..js (module.js:671:10)
at Module.load (module.js:573:32)
at tryModuleLoad (module.js:513:12)
at Function.Module._load (module.js:505:3)
Removing intermediate container 491f4a13f415
The command '/bin/sh -c $(npm bin)/ng build --prod --build-optimizer' returned a non-zero code: 1
ERROR: Build failed: The command '/bin/sh -c $(npm bin)/ng build --prod --build-optimizer' returned a non-zero code: 1
ERROR: Build failed with exit code 2
ERROR: Build in 'development:/web.dockerfile' (52143fff) failed in 0:07:00

Dockerfile

### STAGE 1: Build ###
FROM node:9.3.0-alpine as builder

COPY package.json ./

RUN npm set progress=false && npm config set depth 0 && npm cache clean --force

## Storing node modules on a separate layer will prevent unnecessary npm installs at each build
RUN npm i
RUN mkdir /web
RUN cp -R ./node_modules ./web

WORKDIR /web

COPY . .

## Build the angular app in production mode and store the artifacts in dist folder
RUN $(npm bin)/ng build --prod --build-optimizer

### STAGE 2: Setup ###

FROM nginx:1.13.8-alpine

COPY nginx.conf /etc/nginx/nginx.conf
COPY site.conf /etc/nginx/conf.d/default.conf
RUN rm -rf /usr/share/nginx/html/*

COPY --from=builder /web/dist /usr/share/nginx/html/

RUN touch /var/run/nginx.pid && \
  chown -R nginx:nginx /var/run/nginx.pid && \
  chown -R nginx:nginx /var/cache/nginx && \
  chown -R nginx:nginx /usr/share/nginx/html

USER nginx

How would one debug this further?

1 Answer 1

2

@ihue i think its issue angular-cli. what version your angular-cli ?

try to below:

1.editing your package.json changing the line "@angular/cli": "1.x.0", to "@angular/cli": "^1.x.0",

note: 1.x.0 is your angular-cli version

2.add command to update npm update -g @angular/cli

reference of issue Cannot find module '@angular-devkit/core'

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.