Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dockerでビルドが失敗する(ERR! node-pre-gyp -v v1.0.11) #126

Open
nakkaa opened this issue Dec 31, 2023 · 1 comment
Open

Dockerでビルドが失敗する(ERR! node-pre-gyp -v v1.0.11) #126

nakkaa opened this issue Dec 31, 2023 · 1 comment

Comments

@nakkaa
Copy link

nakkaa commented Dec 31, 2023

docker compose buildを行うとnpm buildでFAILします。。。

バージョン

docker

$ docker version
Client: Docker Engine - Community
 Version:           24.0.6
 API version:       1.43
 Go version:        go1.20.7
 Git commit:        ed223bc
 Built:             Mon Sep  4 12:31:44 2023
 OS/Arch:           linux/amd64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          24.0.6
  API version:      1.43 (minimum version 1.12)
  Go version:       go1.20.7
  Git commit:       1a79695
  Built:            Mon Sep  4 12:31:44 2023
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.24
  GitCommit:        61f9fd88f79f081d64d6fa3bb1a0dc71ec870523
 runc:
  Version:          1.1.9
  GitCommit:        v1.1.9-0-gccaecfc
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

ai

$ git log --oneline -n1
341b0ea (HEAD -> master, origin/master, origin/HEAD) sendMessageで(公開範囲)ダイレクトに送信するようにする (#121)

エラーログ

 => ERROR [app 6/6] RUN npm install && npm run build                                                                                                                                                          69.1s 
------                                                                                                                                                                                                              
 > [app 6/6] RUN npm install && npm run build:                                                                                                                                                                      
56.43 npm WARN deprecated [email protected]: Use your platform's native DOMException instead                                                                                                                       
57.55 npm WARN deprecated [email protected]: Use your platform's native performance.now() and performance.timeOrigin.                                                                                               
58.25 npm WARN deprecated [email protected]: Please see https://github.com/lydell/urix#deprecated                                                                                                                          
58.30 npm WARN deprecated [email protected]: https://github.com/lydell/resolve-url#deprecated                                                                                                                       
58.72 npm WARN deprecated [email protected]: request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142
58.78 npm WARN deprecated [email protected]: See https://github.com/lydell/source-map-url#deprecated
58.86 npm WARN deprecated [email protected]: See https://github.com/lydell/source-map-resolve#deprecated
58.94 npm WARN deprecated [email protected]: Use your platform's native atob() and btoa() methods instead
58.94 npm WARN deprecated [email protected]: this library is no longer supported
59.01 npm WARN deprecated [email protected]: some dependency vulnerabilities fixed, support for node < 10 dropped, and newer ECMAScript syntax/features added
59.09 npm WARN deprecated @types/[email protected]: This is a stub types definition for chalk (https://github.com/chalk/chalk). chalk provides its own type definitions, so you don't need @types/chalk installed!
59.38 npm WARN deprecated @koa/[email protected]: **IMPORTANT 10x+ PERFORMANCE UPGRADE**: Please upgrade to v12.0.1+ as we have fixed an issue with debuglog causing 10x slower router benchmark performance, see https://github.com/koajs/router/pull/173
59.94 npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
59.95 npm WARN deprecated [email protected]: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
68.94 npm notice 
68.94 npm notice New patch version of npm available! 10.2.3 -> 10.2.5
68.94 npm notice Changelog: <https://github.com/npm/cli/releases/tag/v10.2.5>
68.94 npm notice Run `npm install -g [email protected]` to update!
68.95 npm notice 
68.95 npm ERR! code 1
68.95 npm ERR! path /ai/node_modules/canvas
68.95 npm ERR! command failed
68.96 npm ERR! command sh -c node-pre-gyp install --fallback-to-build --update-binary
68.96 npm ERR! Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --update-binary --module=/ai/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/ai/node_modules/canvas/build/Release --napi_version=9 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v115' (1)
68.96 npm ERR! node-pre-gyp info it worked if it ends with ok
68.96 npm ERR! node-pre-gyp info using [email protected]
68.96 npm ERR! node-pre-gyp info using [email protected] | linux | x64
68.96 npm ERR! node-pre-gyp http GET https://github.com/Automattic/node-canvas/releases/download/v2.10.2/canvas-v2.10.2-node-v115-linux-glibc-x64.tar.gz
68.96 npm ERR! node-pre-gyp ERR! install response status 404 Not Found on https://github.com/Automattic/node-canvas/releases/download/v2.10.2/canvas-v2.10.2-node-v115-linux-glibc-x64.tar.gz 
68.96 npm ERR! node-pre-gyp WARN Pre-built binaries not installable for [email protected] and [email protected] (node-v115 ABI, glibc) (falling back to source compile with node-gyp) 
68.96 npm ERR! node-pre-gyp WARN Hit error response status 404 Not Found on https://github.com/Automattic/node-canvas/releases/download/v2.10.2/canvas-v2.10.2-node-v115-linux-glibc-x64.tar.gz 
68.96 npm ERR! gyp info it worked if it ends with ok
68.96 npm ERR! gyp info using [email protected]
68.96 npm ERR! gyp info using [email protected] | linux | x64
68.96 npm ERR! gyp info ok 
68.96 npm ERR! gyp info it worked if it ends with ok
68.96 npm ERR! gyp info using [email protected]
68.96 npm ERR! gyp info using [email protected] | linux | x64
68.96 npm ERR! gyp info find Python using Python version 3.9.2 found at "/usr/bin/python3"
68.96 npm ERR! gyp http GET https://nodejs.org/download/release/v20.10.0/node-v20.10.0-headers.tar.gz
68.96 npm ERR! gyp http 200 https://nodejs.org/download/release/v20.10.0/node-v20.10.0-headers.tar.gz
68.96 npm ERR! gyp http GET https://nodejs.org/download/release/v20.10.0/SHASUMS256.txt
68.96 npm ERR! gyp http 200 https://nodejs.org/download/release/v20.10.0/SHASUMS256.txt
68.96 npm ERR! gyp info spawn /usr/bin/python3
68.96 npm ERR! gyp info spawn args [
68.96 npm ERR! gyp info spawn args '/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
68.96 npm ERR! gyp info spawn args 'binding.gyp',
68.96 npm ERR! gyp info spawn args '-f',
68.96 npm ERR! gyp info spawn args 'make',
68.96 npm ERR! gyp info spawn args '-I',
68.96 npm ERR! gyp info spawn args '/ai/node_modules/canvas/build/config.gypi',
68.96 npm ERR! gyp info spawn args '-I',
68.96 npm ERR! gyp info spawn args '/usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
68.97 npm ERR! gyp info spawn args '-I',
68.97 npm ERR! gyp info spawn args '/root/.cache/node-gyp/20.10.0/include/node/common.gypi',
68.97 npm ERR! gyp info spawn args '-Dlibrary=shared_library',
68.97 npm ERR! gyp info spawn args '-Dvisibility=default',
68.97 npm ERR! gyp info spawn args '-Dnode_root_dir=/root/.cache/node-gyp/20.10.0',
68.97 npm ERR! gyp info spawn args '-Dnode_gyp_dir=/usr/local/lib/node_modules/npm/node_modules/node-gyp',
68.97 npm ERR! gyp info spawn args '-Dnode_lib_file=/root/.cache/node-gyp/20.10.0/<(target_arch)/node.lib',
68.97 npm ERR! gyp info spawn args '-Dmodule_root_dir=/ai/node_modules/canvas',
68.97 npm ERR! gyp info spawn args '-Dnode_engine=v8',
68.97 npm ERR! gyp info spawn args '--depth=.',
68.97 npm ERR! gyp info spawn args '--no-parallel',
68.97 npm ERR! gyp info spawn args '--generator-output',
68.97 npm ERR! gyp info spawn args 'build',
68.97 npm ERR! gyp info spawn args '-Goutput_dir=.'
68.97 npm ERR! gyp info spawn args ]
68.97 npm ERR! Package pangocairo was not found in the pkg-config search path.
68.97 npm ERR! Perhaps you should add the directory containing `pangocairo.pc'
68.97 npm ERR! to the PKG_CONFIG_PATH environment variable
68.97 npm ERR! No package 'pangocairo' found
68.97 npm ERR! gyp: Call to 'pkg-config pangocairo --libs' returned exit status 1 while in binding.gyp. while trying to load binding.gyp
68.97 npm ERR! gyp ERR! configure error 
68.97 npm ERR! gyp ERR! stack Error: `gyp` failed with exit code: 1
68.97 npm ERR! gyp ERR! stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:271:18)
68.97 npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:514:28)
68.97 npm ERR! gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:294:12)
68.97 npm ERR! gyp ERR! System Linux 5.15.0-89-generic
68.97 npm ERR! gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--update-binary" "--module=/ai/node_modules/canvas/build/Release/canvas.node" "--module_name=canvas" "--module_path=/ai/node_modules/canvas/build/Release" "--napi_version=9" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v115"
68.97 npm ERR! gyp ERR! cwd /ai/node_modules/canvas
68.97 npm ERR! gyp ERR! node -v v20.10.0
68.97 npm ERR! gyp ERR! node-gyp -v v10.0.1
68.97 npm ERR! gyp ERR! not ok 
68.97 npm ERR! node-pre-gyp ERR! build error 
68.97 npm ERR! node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --update-binary --module=/ai/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/ai/node_modules/canvas/build/Release --napi_version=9 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v115' (1)
68.97 npm ERR! node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/ai/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js:89:23)
68.97 npm ERR! node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:514:28)
68.97 npm ERR! node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1105:16)
68.97 npm ERR! node-pre-gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:305:5)
68.97 npm ERR! node-pre-gyp ERR! System Linux 5.15.0-89-generic
68.97 npm ERR! node-pre-gyp ERR! command "/usr/local/bin/node" "/ai/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build" "--update-binary"
68.97 npm ERR! node-pre-gyp ERR! cwd /ai/node_modules/canvas
68.97 npm ERR! node-pre-gyp ERR! node -v v20.10.0
68.97 npm ERR! node-pre-gyp ERR! node-pre-gyp -v v1.0.11
68.97 npm ERR! node-pre-gyp ERR! not ok
68.97 
68.97 npm ERR! A complete log of this run can be found in: /root/.npm/_logs/2023-12-31T07_59_18_355Z-debug-0.log
------
failed to solve: process "/bin/sh -c npm install && npm run build" did not complete successfully: exit code: 1
@nakkaa
Copy link
Author

nakkaa commented Dec 31, 2023

node-pre-gyp http GET https://github.com/Automattic/node-canvas/releases/download/v2.10.2/canvas-v2.10.2-node-v115-linux-glibc-x64.tar.gz
68.96 npm ERR! node-pre-gyp ERR! install response status 404 Not Found on https://github.com/Automattic/node-canvas/releases/download/v2.10.2/canvas-v2.10.2-node-v115-linux-glibc-x64.tar.gz 
68.96 npm ERR!

node-canvasのnode v20対応はv2.11.2からのようです。
https://github.com/Automattic/node-canvas/releases/

package.jsonを以下のように書き換えたところ、ビルドできました。

$ git diff
diff --git a/package.json b/package.json
index 632b9fb..3dbb539 100644
--- a/package.json
+++ b/package.json
@@ -18,7 +18,7 @@
                "@types/uuid": "8.3.1",
                "@types/ws": "7.4.6",
                "autobind-decorator": "2.4.0",
-               "canvas": "2.10.2",
+               "canvas": "2.11.2",
                "chalk": "4.1.1",
                "lokijs": "1.5.12",
                "memory-streams": "0.1.3",
@@ -35,7 +35,8 @@
                "twemoji-parser": "13.1.0",
                "typescript": "4.3.5",
                "uuid": "8.3.2",
-               "ws": "7.5.2"
+               "ws": "7.5.2",
+               "@types/babel__traverse": "7.18.3"
        },
        "devDependencies": {
                "@koa/router": "9.4.0",

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant