question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error on ng new --collection=@angular/bazel

See original GitHub issue

🐞 Bug report

Command

  • new

Is this a regression?

I don’t know.

Description

Creating a new Bazel-based project with ng new produces an error.

🔬 Minimal Reproduction

From a freshly created Google Cloud Shell:

nvm install --lts && NG_CLI_ANALYTICS=false npm install -g @angular/cli @angular/bazel && NG_CLI_ANALYTICS=false ng new --collection=@angular/bazel --interactive=false repro

🔥 Exception or Error

Installing latest LTS version.
Downloading and installing node v12.14.1...
Downloading https://nodejs.org/dist/v12.14.1/node-v12.14.1-linux-x64.tar.xz...
######################################################################## 100.0%
Computing checksum with sha256sum
Checksums matched!
Now using node v12.14.1 (npm v6.13.4)
/usr/local/nvm/versions/node/v12.14.1/bin/ngc-wrapped -> /usr/local/nvm/versions/node/v12.14.1/lib/node_modules/@angular/bazel/src/ngc-wrapped/index.js
/usr/local/nvm/versions/node/v12.14.1/bin/packager -> /usr/local/nvm/versions/node/v12.14.1/lib/node_modules/@angular/bazel/src/ng_package/packager.js
/usr/local/nvm/versions/node/v12.14.1/bin/xi18n -> /usr/local/nvm/versions/node/v12.14.1/lib/node_modules/@angular/bazel/src/ngc-wrapped/extract_i18n.js
/usr/local/nvm/versions/node/v12.14.1/bin/modify_tsconfig -> /usr/local/nvm/versions/node/v12.14.1/lib/node_modules/@angular/bazel/src/modify_tsconfig.js
/usr/local/nvm/versions/node/v12.14.1/bin/ng -> /usr/local/nvm/versions/node/v12.14.1/lib/node_modules/@angular/cli/bin/ng

> @angular/cli@8.3.24 postinstall /usr/local/nvm/versions/node/v12.14.1/lib/node_modules/@angular/cli
> node ./bin/postinstall/script.js

npm WARN @angular/bazel@7.2.16 requires a peer of @angular/compiler-cli@7.2.16 but none is installed. You must install peer dependencies yourself.
npm WARN @angular/bazel@7.2.16 requires a peer of typescript@>=3.1.1 <3.3 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 (node_modules/@angular/bazel/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.11: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

+ @angular/bazel@7.2.16
+ @angular/cli@8.3.24
added 449 packages from 271 contributors in 20.843s
CREATE repro/README.md (1023 bytes)
CREATE repro/.editorconfig (246 bytes)
CREATE repro/.gitignore (631 bytes)
CREATE repro/angular.json (1669 bytes)
CREATE repro/package.json (1548 bytes)
CREATE repro/tsconfig.json (543 bytes)
CREATE repro/tslint.json (1953 bytes)
CREATE repro/browserslist (429 bytes)
CREATE repro/karma.conf.js (1017 bytes)
CREATE repro/tsconfig.app.json (270 bytes)
CREATE repro/tsconfig.spec.json (270 bytes)
CREATE repro/src/favicon.ico (948 bytes)
CREATE repro/src/index.html (291 bytes)
CREATE repro/src/main.ts (372 bytes)
CREATE repro/src/polyfills.ts (2838 bytes)
CREATE repro/src/styles.css (80 bytes)
CREATE repro/src/test.ts (642 bytes)
CREATE repro/src/assets/.gitkeep (0 bytes)
CREATE repro/src/environments/environment.prod.ts (51 bytes)
CREATE repro/src/environments/environment.ts (662 bytes)
CREATE repro/src/app/app.module.ts (314 bytes)
CREATE repro/src/app/app.component.css (0 bytes)
CREATE repro/src/app/app.component.html (25498 bytes)
CREATE repro/src/app/app.component.spec.ts (978 bytes)
CREATE repro/src/app/app.component.ts (209 bytes)
CREATE repro/e2e/protractor.conf.js (808 bytes)
CREATE repro/e2e/tsconfig.json (214 bytes)
CREATE repro/e2e/src/app.e2e-spec.ts (638 bytes)
CREATE repro/e2e/src/app.po.ts (262 bytes)
CREATE repro/src/main.dev.ts (185 bytes)
CREATE repro/src/main.prod.ts (249 bytes)
CREATE repro/yarn.lock (0 bytes)
CREATE repro/BUILD.bazel (190 bytes)
CREATE repro/WORKSPACE (2023 bytes)
CREATE repro/.bazelignore (18 bytes)
CREATE repro/.bazelrc (1297 bytes)
CREATE repro/angular-metadata.tsconfig.json (540 bytes)
CREATE repro/e2e/BUILD.bazel (1204 bytes)
CREATE repro/e2e/protractor.on-prepare.js (1101 bytes)
CREATE repro/src/BUILD.bazel (3890 bytes)
CREATE repro/src/initialize_testbed.ts (432 bytes)
CREATE repro/src/rxjs_shims.js (1259 bytes)
npm WARN deprecated core-js@2.6.11: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.

> core-js@3.6.4 postinstall /home/taymonbeal/repro/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"


> core-js@2.6.11 postinstall /home/taymonbeal/repro/node_modules/karma/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"


> sauce-connect-launcher@1.3.1 postinstall /home/taymonbeal/repro/node_modules/sauce-connect-launcher
> node scripts/install.js || nodejs scripts/install.js


> @angular/cli@8.3.24 postinstall /home/taymonbeal/repro/node_modules/@angular/cli
> node ./bin/postinstall/script.js


> repro@0.0.0 postinstall /home/taymonbeal/repro
> ngc -p ./angular-metadata.tsconfig.json

node_modules/@angular/cli/commands/add-impl.d.ts(7,37): error TS2307: Cannot find module '../../../../dist-schema/packages/angular/cli/lib/config/schema'.
node_modules/@angular/common/upgrade/upgrade.d.ts(14,31): error TS2307: Cannot find module '@angular/upgrade/static'.
node_modules/@angular/router/upgrade/upgrade.d.ts(9,31): error TS2307: Cannot find module '@angular/upgrade/static'.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! repro@0.0.0 postinstall: `ngc -p ./angular-metadata.tsconfig.json`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the repro@0.0.0 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!     /home/taymonbeal/.npm/_logs/2020-02-01T21_37_23_031Z-debug.log
Package install failed, see above.

The complete log is attached.

🌍 Your Environment


     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 8.3.24
Node: 12.14.1
OS: linux x64
Angular:
...

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.803.24
@angular-devkit/core         8.3.24
@angular-devkit/schematics   8.3.24
@schematics/angular          8.3.24
@schematics/update           0.803.24
rxjs                         6.4.0

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
kyliaucommented, Feb 4, 2020

With the latest version, I followed the reproduction steps below and verified that ng build and ng serve work as expected.

npm install -g @angular/cli @angular/tools-bazel 
ng new --collection=@angular/bazel --interactive=false repro
1reaction
manekinekkocommented, Feb 3, 2020

Alright. So it seems that:

  1. npm i -g @angular/cli@next
  2. ng new bazel-angular
  3. ng add @angular/bazel@next

Made it work!

Avoid using ng new --collection=@angular/bazel for now, until the @angular/bazel tag has been updated on NPM

Here is the working package.json:
{
  "name": "bazel-angular-enhanced",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "postinstall": "ngcc --properties es2015 browser module main",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "~9.0.0-rc.12",
    "@angular/common": "~9.0.0-rc.12",
    "@angular/compiler": "~9.0.0-rc.12",
    "@angular/core": "~9.0.0-rc.12",
    "@angular/forms": "~9.0.0-rc.12",
    "@angular/platform-browser": "~9.0.0-rc.12",
    "@angular/platform-browser-dynamic": "~9.0.0-rc.12",
    "@angular/router": "~9.0.0-rc.12",
    "rxjs": "~6.5.4",
    "tslib": "^1.10.0",
    "zone.js": "~0.10.2"
  },
  "devDependencies": {
    "@angular/bazel": "~9.0.0-rc.12",
    "@angular/cli": "~9.0.0-rc.12",
    "@angular/compiler-cli": "~9.0.0-rc.12",
    "@angular/language-service": "~9.0.0-rc.12",
    "@bazel/bazel": "2.0.0",
    "@bazel/ibazel": "0.10.3",
    "@bazel/karma": "1.2.2",
    "@bazel/protractor": "1.2.2",
    "@bazel/rollup": "1.2.2",
    "@bazel/terser": "1.2.2",
    "@bazel/typescript": "1.2.2",
    "@types/jasmine": "~3.5.0",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "^12.11.1",
    "codelyzer": "^5.1.2",
    "history-server": "1.3.1",
    "html-insert-assets": "0.2.0",
    "jasmine-core": "~3.5.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "4.4.1",
    "karma-chrome-launcher": "3.1.0",
    "karma-coverage-istanbul-reporter": "~2.1.0",
    "karma-firefox-launcher": "1.2.0",
    "karma-jasmine": "2.0.1",
    "karma-jasmine-html-reporter": "^1.4.2",
    "karma-requirejs": "1.1.0",
    "karma-sourcemap-loader": "0.3.7",
    "protractor": "5.4.2",
    "requirejs": "2.3.6",
    "rollup": "1.27.5",
    "rollup-plugin-commonjs": "10.1.0",
    "rollup-plugin-node-resolve": "5.2.0",
    "terser": "4.4.0",
    "ts-node": "~8.3.0",
    "tslint": "~5.18.0",
    "typescript": "~3.7.4"
  }
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

An unhandled exception occurred: Schematic "ng-add" not ...
Error. Unable to find compatible package. Using 'latest'. ... [error] Error: Schematic "ng-add" not found in collection "@angular/bazel". at ...
Read more >
ng serve - Angular
Option Description Value Type Default Value ‑‑hmr Enable hot module replacement. boolean false ‑‑host Host to listen on. string localhost ‑‑open Opens the url in default...
Read more >
Ways to fix “-bash: ng: command not found” - Medium
There are few ways that we can follow to get rid of this error. 1 . Linking angular/cli with npm. This can be...
Read more >
Common Angular Errors - Programming with Mosh
When creating a new project with Angular CLI, you may receive the following error: 'ng' is not recognized as an internal or external...
Read more >
Identify and Fix Build and Deployment Errors in Your Angular ...
This error occurs most commonly within your development environment (while running ng serve ) when you have created a new module on the ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found