teracyhq / docker-files

Teracy docker-files project to build common Docker images
https://hub.docker.com/r/teracy/
MIT License
92 stars 55 forks source link

"ng build" failing but working on local environment #50

Closed Jagpreet16 closed 6 years ago

Jagpreet16 commented 6 years ago

Hi Team,

I am facing this issue from past 4 days. I am using the image teracy/angular-cli to build my project on gitlab. The issue is, with the latest code, the build is failing on gitlab where I use the the image of angular-cli from docker-files. But the same is running successfully on my local enviroment. You can find the logs attached.

Also, my local angular-cli version is 1.0.0-rc.1. You can find the packages.json file below.

{
  "name": "trust-angular2",
  "version": "0.0.0",
  "license": "MIT",
  "angular-cli": {},
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "lint": "tslint \"src/**/*.ts\" --project src/tsconfig.json --type-check && tslint \"e2e/**/*.ts\" --project e2e/tsconfig.json --type-check",
    "test": "ng test",
    "pree2e": "webdriver-manager update --standalone false --gecko false",
    "e2e": "protractor"
  },
  "private": true,
  "dependencies": {
    "@agm/core": "^1.0.0-beta.1",
    "@angular/common": "^2.3.1",
    "@angular/compiler": "^2.3.1",
    "@angular/core": "^2.3.1",
    "@angular/flex-layout": "^2.0.0-rc.1",
    "@angular/forms": "^2.3.1",
    "@angular/http": "^2.3.1",
    "@angular/material": "^2.0.0-beta.2",
    "@angular/platform-browser": "^2.3.1",
    "@angular/platform-browser-dynamic": "^2.3.1",
    "@angular/router": "^3.3.1",
    "@angular2-material/core": "^2.0.0-alpha.7-4",
    "@asymmetrik/ngx-leaflet": "^2.5.1",
    "@ng-idle/core": "^2.0.0-beta.9",
    "@ng-idle/keepalive": "^2.0.0-beta.9",
    "@types/leaflet": "^1.2.2",
    "core-js": "^2.4.1",
    "leaflet": "^1.2.0",
    "ng2-cache-service": "^1.0.2",
    "ng2-cookies": "^1.0.6",
    "ng2-flex-layout": "^0.1.5",
    "ng2-img-cropper": "^0.9.0",
  },
  "devDependencies": {
    "@angular/cli": "^1.0.0-rc.1",
    "@angular/compiler-cli": "^2.3.1",
    "@types/google.analytics": "0.0.33",
    "@types/googlemaps": "^3.29.0",
    "@types/jasmine": "2.5.38",
    "@types/node": "^6.0.42",
    "codelyzer": "~2.0.0-beta.1",
    "protractor": "~4.0.13",
    "ts-node": "1.2.1",
    "tslint": "^4.3.0",
    "typescript": "~2.0.3"
  }
}

Also, below is my npm version on local.

npm: '5.5.1',
  ares: '1.10.1-DEV',
  http_parser: '2.7.0',
  icu: '56.1',
  modules: '48',
  node: '6.11.1',
  openssl: '1.0.2k',
  uv: '1.11.0',
  v8: '5.1.281.103',
  zlib: '1.2.11' 

In short the error I am receiving while deploying with teracy/angular-cli on gitlab is

ERROR in Error encountered resolving symbol values statically. Could not resolve @asymmetrik/ngx-leaflet/dist relative to /builds/vernuso/trust/src/app/task/task.module.ts., resolving symbol TaskModule in /builds/vernuso/trust/src/app/task/task.module.ts, resolving symbol TaskModule in /builds/vernuso/trust/src/app/task/task.module.ts, resolving symbol TaskModule in /builds/vernuso/trust/src/app/task/task.module.ts

ERROR in /builds/vernuso/trust/src/app/task/task.module.ts (2,31): Cannot find module '@asymmetrik/ngx-leaflet/dist'.)

ERROR in ./src/app/task/task.module.ts Module not found: Error: Can't resolve '@asymmetrik/ngx-leaflet/dist' in '/builds/vernuso/trust/src/app/task' @ ./src/app/task/task.module.ts 11:0-61 @ ./src/app/app.module.ts @ ./src/main.ts @ multi ./src/main.ts logs.txt

hoatle commented 6 years ago

@Jagpreet16 if you could set up a public sample project on the gitlab with the mentioned errors, we could help to spot on it.

Otherwise, it's difficult for us to help. Make sure you use the latest stable version of angular-cli and refer to https://github.com/teracyhq/docker-files/tree/master/angular-cli and https://github.com/teracyhq-incubator/angular-boilerplate for reference

Let me know if that works for you.

hoatle commented 6 years ago

You should use teracy/angular-cli:1.4.9 or teracy/angular-cli:1.5.0 and refer to https://github.com/teracyhq-incubator/angular-boilerplate/tree/develop for a working reference, CI works on travis-ci, it's expected that it should work on gitlab-ci, too.

Jagpreet16 commented 6 years ago

Thanks @hoatle for your response. It may take me some time to set up a sample project. I will do that. Meanwhile, I am using the below configuration in my gitlab.yml file. I am not specifying the version anywhere.


build_feature:
  tags:
  - build-grc
  image: teracy/angular-cli
  script: "
    ng build --dev --app app;
    ng build --dev --app auth;
    mv ng/auth/auth.html ng/auth/index.html; "
  stage: build-dev
  artifacts:
    when: on_success
    expire_in: 1h
    untracked: true
    paths:
    - ng/

Any suggestions?

hoatle commented 6 years ago

Sorry, without a sample project with detailed console log, I can't tell what is the root cause to fix the problem.

hoatle commented 6 years ago

close now, free to reopen if you want to provide more information.