angular: bug(build) Build broken when doing a clean checkout and following Developer-Explanations

Steps to reproduce and a minimal demo of the problem

Doing a clean checkout of angular leads to several errors when trying to build angular from master. Doing

 git clone https://github.com/angular/angular.git
 npm i
node --max_old_space_size=4000 ./node_modules/.bin/gulp build.js

leads to

[10:24:03] Finished 'build/clean.bundles.benchpress' after 4.45 ms
[10:24:03] Finished 'build/clean.js' after 139 ms
[10:24:03] Starting 'build.js.dev'...
[10:24:03] Finished 'build/clean.tools' after 219 ms
[10:24:03] Starting 'build.tools'...
[10:24:03] Starting '!build.tools'...
[10:24:04] Starting 'clean'...
[10:24:04] Finished 'clean' after 4.89 μs
[10:24:04] Starting '!bundle.ng.polyfills'...
[10:24:04] Starting '!bundles.js.docs'...
[10:24:04] Finished '!bundles.js.docs' after 15 ms
[10:24:04] Finished '!bundle.ng.polyfills' after 335 ms
tools/broccoli/angular_builder.ts(1,16): error TS2304: Cannot find name 'require'.
tools/broccoli/angular_builder.ts(2,10): error TS2304: Cannot find name 'require'.
tools/broccoli/angular_builder.ts(3,23): error TS2304: Cannot find name 'require'.
tools/broccoli/angular_builder.ts(4,20): error TS2304: Cannot find name 'require'.
tools/broccoli/angular_builder.ts(5,12): error TS2304: Cannot find name 'require'.
tools/broccoli/angular_builder.ts(6,22): error TS2304: Cannot find name 'require'.
tools/broccoli/angular_builder.ts(7,9): error TS2304: Cannot find name 'require'.
tools/broccoli/angular_builder.ts(40,48): error TS2304: Cannot find name 'Promise'.
tools/broccoli/angular_builder.ts(46,49): error TS2304: Cannot find name 'Promise'.
tools/broccoli/angular_builder.ts(52,42): error TS2304: Cannot find name 'Promise'.
tools/broccoli/angular_builder.ts(58,49): error TS2304: Cannot find name 'Promise'.
tools/broccoli/angular_builder.ts(64,14): error TS2304: Cannot find name 'Promise'.
tools/broccoli/angular_builder.ts(119,24): error TS2304: Cannot find name 'require'.
tools/broccoli/broccoli-check-imports.ts(1,21): error TS2307: Cannot find module 'fs'.

as the typings are not installed via tsd in the tools folder. Doing a manual tsd install in tools folder then leads to further errors when executing the build:

[10:10:48] Finished '!build.tools' after 3.22 s
[10:10:48] Finished 'build.tools' after 3.22 s
[10:10:48] Starting 'broccoli.js.dev'...
[10:10:48] Starting '!broccoli.js.dev'...
[10:10:48] Starting 'build.js.prod'...
[10:10:48] Starting '!broccoli.js.prod'...
[10:10:48] Starting 'build.js.cjs'...
[10:10:48] Starting '!build.js.cjs'...
[10:10:48] '!broccoli.js.dev' errored after 71 ms
[10:10:48] Error: ENOENT: no such file or directory, lstat 'modules/angular2'
    at Error (native)
    at Object.fs.lstatSync (fs.js:887:18)
    at symlink (/home/christoph/sources/angular/node_modules/symlink-or-copy/index.js:63:26)
    at symlinkOrCopySync (/home/christoph/sources/angular/node_modules/symlink-or-copy/index.js:58:5)
    at /home/christoph/sources/angular/node_modules/broccoli-plugin/read_compat.js:58:9
    at lib$rsvp$$internal$$tryCatch (/home/christoph/sources/angular/node_modules/rsvp/dist/rsvp.js:493:16)
    at lib$rsvp$$internal$$invokeCallback (/home/christoph/sources/angular/node_modules/rsvp/dist/rsvp.js:505:17)
    at lib$rsvp$$internal$$publish (/home/christoph/sources/angular/node_modules/rsvp/dist/rsvp.js:476:11)
    at lib$rsvp$asap$$flush (/home/christoph/sources/angular/node_modules/rsvp/dist/rsvp.js:1198:9)
    at _combinedTickCallback (internal/process/next_tick.js:67:7)

creating this folder manually and running the build leads to:

[10:14:45] Finished 'build.tools' after 3.17 s
[10:14:45] Starting 'broccoli.js.dev'...
[10:14:45] Starting '!broccoli.js.dev'...
[10:14:45] Starting 'build.js.prod'...
[10:14:45] Starting '!broccoli.js.prod'...
[10:14:45] Starting 'build.js.cjs'...
[10:14:45] Starting '!build.js.cjs'...
[10:14:45] '!build.js.cjs' errored after 400 ms
[10:14:45] Error: ENOENT: no such file or directory, lstat '/home/christoph/sources/angular/tmp/funnel-input_base_path-QH7r3x9b.tmp/0/angular2/typings/hammerjs/hammerjs.d.ts'
    at Error (native)
    at Object.fs.lstatSync (fs.js:887:18)
    at symlink (/home/christoph/sources/angular/node_modules/symlink-or-copy/index.js:63:26)
    at Function.symlinkOrCopySync [as sync] (/home/christoph/sources/angular/node_modules/symlink-or-copy/index.js:58:5)
    at Funnel._copy (/home/christoph/sources/angular/node_modules/broccoli-funnel/index.js:398:19)
    at Funnel.processFile (/home/christoph/sources/angular/node_modules/broccoli-funnel/index.js:381:8)
    at Funnel.applyPatch [as _applyPatch] (/home/christoph/sources/angular/node_modules/broccoli-funnel/index.js:298:12)
    at Funnel.<anonymous> (/home/christoph/sources/angular/node_modules/broccoli-funnel/index.js:250:10)
    at Array.forEach (native)
    at Funnel.processFilters (/home/christoph/sources/angular/node_modules/broccoli-funnel/index.js:249:9)

then I gave up…

Expected/desired behavior

Build of a clean checkout should be possible just following the Developer Guidelines:

https://github.com/angular/angular/blob/master/DEVELOPER.md

Other information

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 3
  • Comments: 21 (18 by maintainers)

Most upvoted comments

@ericmartinezr I got this working in a Ubuntu VM. In the second set of that build.sh, I removed the '' from the sed -i '' to match what’s in the ${TRAVIS} section

  if [[ ${TRAVIS} ]]; then
    find ${DESTDIR} -type f -name '*.d.ts' -print0 | xargs -0 sed -i    -e 's/\(^ *(static |private )*\)*readonly  */\1/g'
    find ${DESTDIR} -type f -name '*.d.ts' -print0 | xargs -0 sed -i    -E 's/^( +)abstract ([[:alnum:]]+\:)/\1\2/g'
  else
    // THIS LINE SPECIFICALLY
    find ${DESTDIR} -type f -name '*.d.ts' -print0 | xargs -0 sed -i    -e 's/\(^ *(static |private )*\)*readonly  */\1/g'
    find ${DESTDIR} -type f -name '*.d.ts' -print0 | xargs -0 sed -i    -E 's/^( +)abstract ([[:alnum:]]+\:)/\1\2/g'
  fi

The normal build process is broken at the moment. You can use the ./scripts/ci-lite/install.sh to install dependencies and typings and the ./build.sh scripts to get a build working.

You’ll need to add the following to line 7 in the ./build.sh script

    export NODE_PATH=$NODE_PATH:$(pwd)/dist/all:$(pwd)/dist/tools

Hope this helps