Fail to build tree-sitter-typescript grammars
Problems to solve
Fail to build Model Gateway Docker image due to tree-sitter-typescript
grammars build failures. This breakage will cause all the CI build to fail and we are unable to release a new version of Model Gateway.
❯ docker buildx build --platform linux/amd64 -t code-suggestions-api:test .
[+] Building 77.6s (14/17)
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 1.32kB 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 4.27kB 0.0s
=> [internal] load metadata for docker.io/library/python:3.9.16-slim 1.9s
=> [base-image 1/5] FROM docker.io/library/python:3.9.16-slim@sha256:5cde4e147c4165ad8dbf8a4df9631863766eeb0b79b890fafe6885b3b127af74 0.0s
=> [internal] load build context 0.2s
=> => transferring context: 218.42kB 0.2s
=> CACHED [base-image 2/5] WORKDIR /app 0.0s
=> CACHED [base-image 3/5] COPY poetry.lock pyproject.toml ./ 0.0s
=> CACHED [base-image 4/5] RUN pip install "poetry==1.5.1" 0.0s
=> CACHED [base-image 5/5] RUN poetry config virtualenvs.path /opt/venv 0.0s
=> CACHED [install-image 1/5] RUN apt-get update && apt-get install -y build-essential git curl 0.0s
=> CACHED [install-image 2/5] RUN curl -sL https://deb.nodesource.com/setup_18.x | bash - && apt-get install -y nodejs 0.0s
=> CACHED [install-image 3/5] RUN poetry install --no-interaction --no-ansi --no-cache --no-root --only main 0.0s
=> CACHED [install-image 4/5] COPY scripts /app/scripts 0.0s
=> ERROR [install-image 5/5] RUN poetry run python /app/scripts/build-tree-sitter-lib.py 75.5s
------
> [install-image 5/5] RUN poetry run python /app/scripts/build-tree-sitter-lib.py:
#0 5.555 Checking out grammars in /app/scripts/vendor
#0 5.556 Updating tree-sitter-c
#0 5.614 hint: Pulling without specifying how to reconcile divergent branches is
#0 5.615 hint: discouraged. You can squelch this message by running one of the following
#0 5.615 hint: commands sometime before your next pull:
#0 5.615 hint:
#0 5.615 hint: git config pull.rebase false # merge (the default strategy)
#0 5.615 hint: git config pull.rebase true # rebase
#0 5.615 hint: git config pull.ff only # fast-forward only
#0 5.615 hint:
#0 5.615 hint: You can replace "git config" with "git config --global" to set a default
#0 5.615 hint: preference for all repositories. You can also pass --rebase, --no-rebase,
#0 5.615 hint: or --ff-only on the command line to override the configured default per
#0 5.615 hint: invocation.
#0 6.889 Already up to date.
#0 6.893 Updating tree-sitter-c-sharp
#0 6.939 hint: Pulling without specifying how to reconcile divergent branches is
#0 6.939 hint: discouraged. You can squelch this message by running one of the following
#0 6.940 hint: commands sometime before your next pull:
#0 6.940 hint:
#0 6.940 hint: git config pull.rebase false # merge (the default strategy)
#0 6.940 hint: git config pull.rebase true # rebase
#0 6.940 hint: git config pull.ff only # fast-forward only
#0 6.940 hint:
#0 6.940 hint: You can replace "git config" with "git config --global" to set a default
#0 6.940 hint: preference for all repositories. You can also pass --rebase, --no-rebase,
#0 6.940 hint: or --ff-only on the command line to override the configured default per
#0 6.940 hint: invocation.
#0 8.154 Already up to date.
#0 8.158 Updating tree-sitter-cpp
#0 8.205 hint: Pulling without specifying how to reconcile divergent branches is
#0 8.205 hint: discouraged. You can squelch this message by running one of the following
#0 8.206 hint: commands sometime before your next pull:
#0 8.206 hint:
#0 8.207 hint: git config pull.rebase false # merge (the default strategy)
#0 8.207 hint: git config pull.rebase true # rebase
#0 8.207 hint: git config pull.ff only # fast-forward only
#0 8.207 hint:
#0 8.207 hint: You can replace "git config" with "git config --global" to set a default
#0 8.207 hint: preference for all repositories. You can also pass --rebase, --no-rebase,
#0 8.207 hint: or --ff-only on the command line to override the configured default per
#0 8.207 hint: invocation.
#0 9.423 Already up to date.
#0 9.427 Updating tree-sitter-go
#0 9.472 hint: Pulling without specifying how to reconcile divergent branches is
#0 9.473 hint: discouraged. You can squelch this message by running one of the following
#0 9.473 hint: commands sometime before your next pull:
#0 9.473 hint:
#0 9.473 hint: git config pull.rebase false # merge (the default strategy)
#0 9.473 hint: git config pull.rebase true # rebase
#0 9.473 hint: git config pull.ff only # fast-forward only
#0 9.473 hint:
#0 9.473 hint: You can replace "git config" with "git config --global" to set a default
#0 9.473 hint: preference for all repositories. You can also pass --rebase, --no-rebase,
#0 9.473 hint: or --ff-only on the command line to override the configured default per
#0 9.473 hint: invocation.
#0 10.71 Already up to date.
#0 10.71 Updating tree-sitter-java
#0 10.76 hint: Pulling without specifying how to reconcile divergent branches is
#0 10.76 hint: discouraged. You can squelch this message by running one of the following
#0 10.76 hint: commands sometime before your next pull:
#0 10.76 hint:
#0 10.76 hint: git config pull.rebase false # merge (the default strategy)
#0 10.76 hint: git config pull.rebase true # rebase
#0 10.76 hint: git config pull.ff only # fast-forward only
#0 10.76 hint:
#0 10.76 hint: You can replace "git config" with "git config --global" to set a default
#0 10.76 hint: preference for all repositories. You can also pass --rebase, --no-rebase,
#0 10.76 hint: or --ff-only on the command line to override the configured default per
#0 10.76 hint: invocation.
#0 12.08 Already up to date.
#0 12.09 Updating tree-sitter-javascript
#0 12.13 hint: Pulling without specifying how to reconcile divergent branches is
#0 12.13 hint: discouraged. You can squelch this message by running one of the following
#0 12.13 hint: commands sometime before your next pull:
#0 12.13 hint:
#0 12.13 hint: git config pull.rebase false # merge (the default strategy)
#0 12.13 hint: git config pull.rebase true # rebase
#0 12.13 hint: git config pull.ff only # fast-forward only
#0 12.13 hint:
#0 12.13 hint: You can replace "git config" with "git config --global" to set a default
#0 12.13 hint: preference for all repositories. You can also pass --rebase, --no-rebase,
#0 12.13 hint: or --ff-only on the command line to override the configured default per
#0 12.13 hint: invocation.
#0 13.46 Already up to date.
#0 13.46 Updating tree-sitter-php
#0 13.51 hint: Pulling without specifying how to reconcile divergent branches is
#0 13.51 hint: discouraged. You can squelch this message by running one of the following
#0 13.51 hint: commands sometime before your next pull:
#0 13.51 hint:
#0 13.51 hint: git config pull.rebase false # merge (the default strategy)
#0 13.51 hint: git config pull.rebase true # rebase
#0 13.51 hint: git config pull.ff only # fast-forward only
#0 13.51 hint:
#0 13.51 hint: You can replace "git config" with "git config --global" to set a default
#0 13.51 hint: preference for all repositories. You can also pass --rebase, --no-rebase,
#0 13.51 hint: or --ff-only on the command line to override the configured default per
#0 13.51 hint: invocation.
#0 14.75 Already up to date.
#0 14.76 Updating tree-sitter-python
#0 14.80 hint: Pulling without specifying how to reconcile divergent branches is
#0 14.80 hint: discouraged. You can squelch this message by running one of the following
#0 14.80 hint: commands sometime before your next pull:
#0 14.80 hint:
#0 14.80 hint: git config pull.rebase false # merge (the default strategy)
#0 14.80 hint: git config pull.rebase true # rebase
#0 14.80 hint: git config pull.ff only # fast-forward only
#0 14.80 hint:
#0 14.80 hint: You can replace "git config" with "git config --global" to set a default
#0 14.80 hint: preference for all repositories. You can also pass --rebase, --no-rebase,
#0 14.80 hint: or --ff-only on the command line to override the configured default per
#0 14.80 hint: invocation.
#0 16.09 Already up to date.
#0 16.10 Updating tree-sitter-rust
#0 16.14 hint: Pulling without specifying how to reconcile divergent branches is
#0 16.14 hint: discouraged. You can squelch this message by running one of the following
#0 16.14 hint: commands sometime before your next pull:
#0 16.14 hint:
#0 16.14 hint: git config pull.rebase false # merge (the default strategy)
#0 16.14 hint: git config pull.rebase true # rebase
#0 16.14 hint: git config pull.ff only # fast-forward only
#0 16.14 hint:
#0 16.14 hint: You can replace "git config" with "git config --global" to set a default
#0 16.14 hint: preference for all repositories. You can also pass --rebase, --no-rebase,
#0 16.14 hint: or --ff-only on the command line to override the configured default per
#0 16.14 hint: invocation.
#0 17.44 Already up to date.
#0 17.45 Updating tree-sitter-scala
#0 17.49 hint: Pulling without specifying how to reconcile divergent branches is
#0 17.49 hint: discouraged. You can squelch this message by running one of the following
#0 17.49 hint: commands sometime before your next pull:
#0 17.49 hint:
#0 17.49 hint: git config pull.rebase false # merge (the default strategy)
#0 17.49 hint: git config pull.rebase true # rebase
#0 17.49 hint: git config pull.ff only # fast-forward only
#0 17.49 hint:
#0 17.49 hint: You can replace "git config" with "git config --global" to set a default
#0 17.49 hint: preference for all repositories. You can also pass --rebase, --no-rebase,
#0 17.49 hint: or --ff-only on the command line to override the configured default per
#0 17.49 hint: invocation.
#0 18.76 Already up to date.
#0 18.77 Updating tree-sitter-typescript
#0 18.81 hint: Pulling without specifying how to reconcile divergent branches is
#0 18.81 hint: discouraged. You can squelch this message by running one of the following
#0 18.81 hint: commands sometime before your next pull:
#0 18.81 hint:
#0 18.81 hint: git config pull.rebase false # merge (the default strategy)
#0 18.81 hint: git config pull.rebase true # rebase
#0 18.81 hint: git config pull.ff only # fast-forward only
#0 18.81 hint:
#0 18.81 hint: You can replace "git config" with "git config --global" to set a default
#0 18.81 hint: preference for all repositories. You can also pass --rebase, --no-rebase,
#0 18.81 hint: or --ff-only on the command line to override the configured default per
#0 18.81 hint: invocation.
#0 20.00 You are not currently on a branch.
#0 20.00 Please specify which branch you want to merge with.
#0 20.00 See git-pull(1) for details.
#0 20.00
#0 20.00 git pull <remote> <branch>
#0 20.00
#0 20.31 HEAD is now at 3429d8c Merge pull request #245 from mattmassicotte/feature/spm
#0 24.72
#0 24.72 > tree-sitter-typescript@0.20.2 install
#0 24.72 > node-gyp rebuild
#0 24.72
#0 25.85 gyp info it worked if it ends with ok
#0 25.86 gyp info using node-gyp@9.3.1
#0 25.86 gyp info using node@18.17.0 | linux | x64
#0 26.97 gyp info find Python using Python version 3.9.16 found at "/opt/venv/codesuggestions-9TtSrW0h-py3.9/bin/python3"
#0 27.60 gyp http GET https://nodejs.org/download/release/v18.17.0/node-v18.17.0-headers.tar.gz
#0 28.17 gyp http 200 https://nodejs.org/download/release/v18.17.0/node-v18.17.0-headers.tar.gz
#0 37.53 gyp http GET https://nodejs.org/download/release/v18.17.0/SHASUMS256.txt
#0 37.62 gyp http 200 https://nodejs.org/download/release/v18.17.0/SHASUMS256.txt
#0 37.70 gyp info spawn /opt/venv/codesuggestions-9TtSrW0h-py3.9/bin/python3
#0 37.71 gyp info spawn args [
#0 37.71 gyp info spawn args '/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
#0 37.71 gyp info spawn args 'binding.gyp',
#0 37.71 gyp info spawn args '-f',
#0 37.71 gyp info spawn args 'make',
#0 37.71 gyp info spawn args '-I',
#0 37.71 gyp info spawn args '/app/scripts/vendor/tree-sitter-typescript/build/config.gypi',
#0 37.71 gyp info spawn args '-I',
#0 37.71 gyp info spawn args '/usr/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
#0 37.71 gyp info spawn args '-I',
#0 37.71 gyp info spawn args '/root/.cache/node-gyp/18.17.0/include/node/common.gypi',
#0 37.71 gyp info spawn args '-Dlibrary=shared_library',
#0 37.71 gyp info spawn args '-Dvisibility=default',
#0 37.71 gyp info spawn args '-Dnode_root_dir=/root/.cache/node-gyp/18.17.0',
#0 37.71 gyp info spawn args '-Dnode_gyp_dir=/usr/lib/node_modules/npm/node_modules/node-gyp',
#0 37.71 gyp info spawn args '-Dnode_lib_file=/root/.cache/node-gyp/18.17.0/<(target_arch)/node.lib',
#0 37.71 gyp info spawn args '-Dmodule_root_dir=/app/scripts/vendor/tree-sitter-typescript',
#0 37.71 gyp info spawn args '-Dnode_engine=v8',
#0 37.71 gyp info spawn args '--depth=.',
#0 37.71 gyp info spawn args '--no-parallel',
#0 37.71 gyp info spawn args '--generator-output',
#0 37.71 gyp info spawn args 'build',
#0 37.71 gyp info spawn args '-Goutput_dir=.'
#0 37.71 gyp info spawn args ]
#0 40.04 gyp info spawn make
#0 40.04 gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
#0 40.08 make: Entering directory '/app/scripts/vendor/tree-sitter-typescript/build'
#0 40.10 CC(target) Release/obj.target/tree_sitter_typescript_binding/typescript/src/parser.o
#0 40.55 In file included from ../typescript/src/parser.c:1:
#0 40.55 ../typescript/src/parser.c: In function ‘ts_lex_keywords’:
#0 40.56 ../typescript/src/tree_sitter/parser.h:136:8: warning: variable ‘eof’ set but not used [-Wunused-but-set-variable]
#0 40.56 136 | bool eof = false; \
#0 40.56 | ^~~
#0 40.56 ../typescript/src/parser.c:10142:3: note: in expansion of macro ‘START_LEXER’
#0 40.56 10142 | START_LEXER();
#0 40.56 | ^~~~~~~~~~~
#0 48.72 CC(target) Release/obj.target/tree_sitter_typescript_binding/typescript/src/scanner.o
#0 50.00 CC(target) Release/obj.target/tree_sitter_typescript_binding/tsx/src/parser.o
#0 50.42 In file included from ../tsx/src/parser.c:1:
#0 50.42 ../tsx/src/parser.c: In function ‘ts_lex_keywords’:
#0 50.43 ../typescript/src/tree_sitter/parser.h:136:8: warning: variable ‘eof’ set but not used [-Wunused-but-set-variable]
#0 50.43 136 | bool eof = false; \
#0 50.43 | ^~~
#0 50.43 ../tsx/src/parser.c:10618:3: note: in expansion of macro ‘START_LEXER’
#0 50.43 10618 | START_LEXER();
#0 50.43 | ^~~~~~~~~~~
#0 58.92 CC(target) Release/obj.target/tree_sitter_typescript_binding/tsx/src/scanner.o
#0 60.18 CXX(target) Release/obj.target/tree_sitter_typescript_binding/bindings/node/binding.o
#0 64.75 In file included from ../bindings/node/binding.cc:2:
#0 64.75 /root/.cache/node-gyp/18.17.0/include/node/node.h:1014:7: warning: cast between incompatible function types from ‘void (*)(v8::Local<v8::Object>, v8::Local<v8::Object>)’ to ‘node::addon_register_func’ {aka ‘void (*)(v8::Local<v8::Object>, v8::Local<v8::Value>, void*)’} [-Wcast-function-type]
#0 64.75 1014 | (node::addon_register_func) (regfunc), \
#0 64.75 | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#0 64.75 /root/.cache/node-gyp/18.17.0/include/node/node.h:1048:3: note: in expansion of macro ‘NODE_MODULE_X’
#0 64.75 1048 | NODE_MODULE_X(modname, regfunc, NULL, 0) // NOLINT (readability/null_usage)
#0 64.75 | ^~~~~~~~~~~~~
#0 64.75 ../bindings/node/binding.cc:35:1: note: in expansion of macro ‘NODE_MODULE’
#0 64.75 35 | NODE_MODULE(tree_sitter_typescript_binding, Init)
#0 64.75 | ^~~~~~~~~~~
#0 66.39 SOLINK_MODULE(target) Release/obj.target/tree_sitter_typescript_binding.node
#0 66.74 COPY Release/tree_sitter_typescript_binding.node
#0 66.83 make: Leaving directory '/app/scripts/vendor/tree-sitter-typescript/build'
#0 66.84 gyp info ok
#0 66.91
#0 66.91 up to date, audited 4 packages in 45s
#0 66.92
#0 66.92 found 0 vulnerabilities
#0 66.92 npm notice
#0 66.92 npm notice New minor version of npm available! 9.6.7 -> 9.8.1
#0 66.92 npm notice Changelog: <https://github.com/npm/cli/releases/tag/v9.8.1>
#0 66.92 npm notice Run `npm install -g npm@9.8.1` to update!
#0 66.93 npm notice
#0 69.33
#0 69.33 > tree-sitter-typescript@0.20.2 build
#0 69.33 > npm run build-typescript && npm run build-tsx
#0 69.33
#0 71.63
#0 71.63 > tree-sitter-typescript@0.20.2 build-typescript
#0 71.63 > cd typescript && npx tree-sitter generate --no-bindings
#0 71.63
#0 75.21 /app/scripts/vendor/tree-sitter-typescript/node_modules/tree-sitter-cli/tree-sitter: 1: Syntax error: ")" unexpected
#0 75.35 error building tree-sitter-typescript
------
Dockerfile:39
--------------------
37 | # Build tree-sitter library for the grammars supported
38 | COPY scripts /app/scripts
39 | >>> RUN poetry run python /app/scripts/build-tree-sitter-lib.py
40 |
41 | ##
--------------------
ERROR: failed to solve: process "/bin/sh -c poetry run python /app/scripts/build-tree-sitter-lib.py" did not complete successfully: exit code: 1
To build tree-sitter grammars, we are pulling the latest version of Node v18 (see code) and the most recent version v18.17.0
might be incompatible with tree-sitter-typescript
.
Proposals
Few ideas to try.
- Downgrade to
v16
- Pin to a previous version
v18.16.1
- Upgrade to
v20
Edited by Tan Le