components: dev-infra: can't build project or run dev-app on MacBooks with m1 CPUs

What are you trying to do?

I’ve switched to an m1Max MacBook Pro as my main device now.

I’ve got Bazel 4.2.1 installed locally, but the build seems to be trying to install Bazel 4.0.0 and failing.

Screen Shot 2021-11-18 at 13 57 43

  1. Build the project
  2. Run the dev-app

What troubleshooting steps have you tried?

Setting my BAZEL environment variable as discussed in https://github.com/angular/angular/issues/40498#issuecomment-973159023. This fixed Bazel builds for Framework, but not Components.

Reproduction

Steps to reproduce:

  1. yarn
  2. yarn build
splaktar-m1max:components splaktar$ yarn build
yarn run v1.22.17
$ ts-node --project scripts/tsconfig.json ./scripts/build-packages-dist.ts
######################################
  Building release packages...
######################################
2021/11/18 13:54:15 Downloading https://releases.bazel.build/4.0.0/release/bazel-4.0.0-darwin-arm64...
2021/11/18 13:54:15 could not download Bazel: HTTP GET https://releases.bazel.build/4.0.0/release/bazel-4.0.0-darwin-arm64 failed with error 404
Error: Command failed: bazel query --output=label "attr('tags', '\[.*release-package.*\]', //src/...) intersect kind('.*_package', //src/...)"
    at checkExecSyncError (node:child_process:826:11)
    at execSync (node:child_process:900:15)
    at exec (/Users/splaktar/Git/angular/components/scripts/build-packages-dist.ts:137:26)
    at buildReleasePackages (/Users/splaktar/Git/angular/components/scripts/build-packages-dist.ts:69:19)
    at performDefaultSnapshotBuild (/Users/splaktar/Git/angular/components/scripts/build-packages-dist.ts:56:10)
    at Object.<anonymous> (/Users/splaktar/Git/angular/components/scripts/build-packages-dist.ts:43:3)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Module.m._compile (/Users/splaktar/Git/angular/components/node_modules/ts-node/src/index.ts:1310:23)
    at Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Object.require.extensions.<computed> [as .ts] (/Users/splaktar/Git/angular/components/node_modules/ts-node/src/index.ts:1313:12) {
  status: 1,
  signal: null,
  output: [ null, Buffer(0) [Uint8Array] [], null ],
  pid: 63907,
  stdout: Buffer(0) [Uint8Array] [],
  stderr: null
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
  1. yarn dev-app
splaktar-m1max:components splaktar$ yarn dev-app
yarn run v1.22.17
$ ibazel run //src/dev-app:devserver
FATAL: Your platform/architecture combination darwin - arm64 is not yet supported.
    Follow install instructions at https://github.com/bazelbuild/bazel-watcher/blob/master/README.md to compile for your system.
node:internal/validators:119
    throw new ERR_INVALID_ARG_TYPE(name, 'string', value);
    ^

TypeError [ERR_INVALID_ARG_TYPE]: The "file" argument must be of type string. Received an instance of Promise
    at new NodeError (node:internal/errors:371:5)
    at validateString (node:internal/validators:119:11)
    at normalizeSpawnArguments (node:child_process:503:3)
    at spawn (node:child_process:691:13)
    at main (/Users/splaktar/Git/angular/components/node_modules/@bazel/ibazel/index.js:82:18)
    at Object.<anonymous> (/Users/splaktar/Git/angular/components/node_modules/@bazel/ibazel/index.js:96:3)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12) {
  code: 'ERR_INVALID_ARG_TYPE'
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
  1. yarn test material/button
splaktar-m1max:components splaktar$ yarn test material/button
yarn run v1.22.17
$ node ./scripts/run-component-tests.js material/button
FATAL: Your platform/architecture combination darwin - arm64 is not yet supported.
    Follow install instructions at https://github.com/bazelbuild/bazel-watcher/blob/master/README.md to compile for your system.
node:internal/validators:119
    throw new ERR_INVALID_ARG_TYPE(name, 'string', value);
    ^

TypeError [ERR_INVALID_ARG_TYPE]: The "file" argument must be of type string. Received an instance of Promise
    at new NodeError (node:internal/errors:371:5)
    at validateString (node:internal/validators:119:11)
    at normalizeSpawnArguments (node:child_process:503:3)
    at spawn (node:child_process:691:13)
    at main (/Users/splaktar/Git/angular/components/node_modules/@bazel/ibazel/index.js:82:18)
    at Object.<anonymous> (/Users/splaktar/Git/angular/components/node_modules/@bazel/ibazel/index.js:96:3)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12) {
  code: 'ERR_INVALID_ARG_TYPE'
}
/Users/splaktar/Git/angular/components/node_modules/shelljs/src/common.js:401
      if (config.fatal) throw e;
                        ^

Error: exec: FATAL: Your platform/architecture combination darwin - arm64 is not yet supported.
    Follow install instructions at https://github.com/bazelbuild/bazel-watcher/blob/master/README.md to compile for your system.
node:internal/validators:119
    throw new ERR_INVALID_ARG_TYPE(name, 'string', value);
    ^

TypeError [ERR_INVALID_ARG_TYPE]: The "file" argument must be of type string. Received an instance of Promise
    at new NodeError (node:internal/errors:371:5)
    at validateString (node:internal/validators:119:11)
    at normalizeSpawnArguments (node:child_process:503:3)
    at spawn (node:child_process:691:13)
    at main (/Users/splaktar/Git/angular/components/node_modules/@bazel/ibazel/index.js:82:18)
    at Object.<anonymous> (/Users/splaktar/Git/angular/components/node_modules/@bazel/ibazel/index.js:96:3)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12) {
  code: 'ERR_INVALID_ARG_TYPE'
}

    at Object.error (/Users/splaktar/Git/angular/components/node_modules/shelljs/src/common.js:110:27)
    at execSync (/Users/splaktar/Git/angular/components/node_modules/shelljs/src/exec.js:102:12)
    at Object._exec (/Users/splaktar/Git/angular/components/node_modules/shelljs/src/exec.js:205:12)
    at Object.exec (/Users/splaktar/Git/angular/components/node_modules/shelljs/src/common.js:335:23)
    at Object.<anonymous> (/Users/splaktar/Git/angular/components/scripts/run-component-tests.js:102:9)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:79:12)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Environment

  • Angular: 13.0.1
  • CDK/Material: master
  • Browser(s): Chrome 95.0.4638.69 (Official Build) (arm64)
  • Operating System (e.g. Windows, macOS, Ubuntu): macOS Monterey 12.0.1 (21A559)
  • Bazel: 4.2.1- (@non-git) /opt/local/bin/bazel

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 19 (13 by maintainers)

Most upvoted comments

Also wanted to mention that I will be using M1 only for the next couple of weeks/and potentially months (as I had to move without my Windows machine). So I’m sure we’ll be able to get to this very soon. Still want to mention though that I think the majority of workflows should work. The key really is currently using Bazel globally, and avoiding ibazel (or using a custom build)

Had the same issue @Splaktar. Made it work for me following these steps.

  1. After forking the most recent angular/components release, I first had to downgrade me node version to 16.x.
  2. Followed this guide to compile ibazel on my device (honestly not sure if it did anything)
  3. Bumped up the ibazel version in my package.json from “@bazel/ibazel”: “0.15.10” to “@bazel/ibazel”: “0.16.2”, this version seems to support the M1
  4. yarn then yarn dev-app first time did somehow fail, started again and it ran through

Hope this helps.

If I bump

https://github.com/angular/components/blob/3deca241f994cab5837909a4410256a9e0541cda/package.json#L89

to 0.16.2, I get farther but now I see this:

$ yarn dev-app
yarn run v1.22.17
$ ibazel run //src/dev-app:devserver
iBazel [1:57PM]: You are using an experimental filesystem watcher. If you would like to disable that, please set the environment variable
        IBAZEL_USE_LEGACY_WATCHER=1
iBazel [1:57PM]: Error getting Bazel info exit status 2
iBazel [1:57PM]: Querying for files to watch...
iBazel [1:57PM]: Error getting Bazel info exit status 2
Error finding remote repositories directory: exit status 2
iBazel [1:57PM]: Error getting Bazel info exit status 2
Error finding remote repositories directory: exit status 2
iBazel [1:57PM]: Running //src/dev-app:devserver
Loading: 
Loading: 0 packages loaded
ERROR: Failed to load Starlark extension '@npm//@bazel/protractor:package.bzl'.
Cycle in the workspace file detected. This indicates that a repository is used prior to being defined.
The following chain of repository dependencies lead to the missing definition.
 - @npm
 - @nodejs_darwin_arm64
This could either mean you have to add the '@nodejs_darwin_arm64' repository with a statement like `http_archive` in your WORKSPACE file (note that transitive dependencies are not added automatically), or move an existing definition earlier in your WORKSPACE file.
ERROR: cycles detected during target parsing
INFO: Elapsed time: 0.120s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)
FAILED: Build did NOT complete successfully (0 packages loaded)
iBazel [1:57PM]: Error running Bazel exit status 1
error Command failed with exit code 4.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.