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-compose fails (node-pre-gyp) #255

Closed
bryik opened this issue Mar 11, 2019 · 4 comments
Closed

docker-compose fails (node-pre-gyp) #255

bryik opened this issue Mar 11, 2019 · 4 comments

Comments

@bryik
Copy link
Contributor

bryik commented Mar 11, 2019

I'm trying to get the editor running locally with Docker on Windows.

Everything is fine up until the "Linking dependencies" stage:

[3/4] Linking dependencies...
warning " > [email protected]" has incorrect peer dependency "monaco-editor@^0.15.1".
[4/4] Building fresh packages...
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
error /usr/src/app/node_modules/canvas: Command failed.
Exit code: 1
Command: node-pre-gyp install --fallback-to-build
Arguments:
Directory: /usr/src/app/node_modules/canvas
Output:
node-pre-gyp info it worked if it ends with ok
node-pre-gyp info using [email protected]
node-pre-gyp info using [email protected] | linux | x64
node-pre-gyp WARN Using needle for node-pre-gyp https download
node-pre-gyp info check checked for "/usr/src/app/node_modules/canvas/build/Release/canvas.node" (not found)
node-pre-gyp http GET https://github.com/node-gfx/node-canvas-prebuilt/releases/download/v2.3.1/canvas-v2.3.1-node-v67-linux-musl-x64.tar.gz
node-pre-gyp http 404 https://github.com/node-gfx/node-canvas-prebuilt/releases/download/v2.3.1/canvas-v2.3.1-node-v67-linux-musl-x64.tar.gz
node-pre-gyp WARN Tried to download(404): https://github.com/node-gfx/node-canvas-prebuilt/releases/download/v2.3.1/canvas-v2.3.1-node-v67-linux-musl-x64.tar.gz
node-pre-gyp WARN Pre-built binaries not found for [email protected] and [email protected] (node-v67 ABI, musl) (falling back to source compile with node-gyp)
node-pre-gyp http 404 status code downloading tarball https://github.com/node-gfx/node-canvas-prebuilt/releases/download/v2.3.1/canvas-v2.3.1-node-v67-linux-musl-x64.tar.gz
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp info ok
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack     at PythonFinder.failNoPython (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:484:19)
gyp ERR! stack     at PythonFinder.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:406:16)
gyp ERR! stack     at F (/usr/local/lib/node_modules/npm/node_modules/which/which.js:68:16)
gyp ERR! stack     at E (/usr/local/lib/node_modules/npm/node_modules/which/which.js:80:29)
gyp ERR! stack     at /usr/local/lib/node_modules/npm/node_modules/which/which.js:89:16
gyp ERR! stack     at /usr/local/lib/node_modules/npm/node_modules/isexe/index.js:42:5
gyp ERR! stack     at /usr/local/lib/node_modules/npm/node_modules/isexe/mode.js:8:5
gyp ERR! stack     at FSReqCallback.oncomplete (fs.js:158:21)
gyp ERR! System Linux 4.9.125-linuxkit
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" "--module=/usr/src/app/node_modules/canvas/build/Release/canvas.node" "--module_name=canvas" "--module_path=/usr/src/app/node_modules/canvas/build/Release" "--napi_version=4" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v67"
gyp ERR! cwd /usr/src/app/node_modules/canvas
gyp ERR! node -v v11.11.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
node-pre-gyp ERR! build error
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 --module=/usr/src/app/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/usr/src/app/node_modules/canvas/build/Release --napi_version=4 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v67' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/usr/src/app/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:197:13)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:984:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:265:5)
node-pre-gyp ERR! System Linux 4.9.125-linuxkit
node-pre-gyp ERR! command "/usr/local/bin/node" "/usr/src/app/node_modules/canvas/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /usr/src/app/node_modules/canvas
node-pre-gyp ERR! node -v v11.11.0
node-pre-gyp ERR! node-pre-gyp -v v0.11.0
node-pre-gyp ERR! not ok
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 --module=/usr/src/app/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/usr/src/app/node_modules/canvas/build/Release --napi_version=4 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v67' (1)
ERROR: Service 'editor' failed to build: The command '/bin/sh -c yarn' returned a non-zero code: 1
@bryik
Copy link
Contributor Author

bryik commented Mar 11, 2019

So the major issue was that node-pre-gyp is required for a dependency (canvas) and was unavailable.

It tries to get a pre-build file, but fails because it doesn't exist:

node-pre-gyp http 404 https://github.com/node-gfx/node-canvas-prebuilt/releases/download/v2.3.1/canvas-v2.3.1-node-v67-linux-musl-x64.tar.gz

There are currently no pre-built binaries that work with Alpine Linux because it uses musl.

Since this fails, node-pre-gyp tries to build canvas. However, Alpine Linux lacks the tools necessary to complete the build so this also fails. I tried installing some of the missing tools, but each addition uncovered another missing dependency. Eventually, I gave up and switched the distro to Debian.

FROM node:11

Which was able to build canvas.

There was one other bug: ./vendor.sh has embedded ./r characters resulting in:

> [email protected] vendor /usr/src/app
> ./scripts/vendor.sh

Copying data to 'public/data'.
Copy examples to 'public/spec'.
/usr/bin/env: 'bash\r': No such file or directory
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! [email protected] vendor: `./scripts/vendor.sh`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the [email protected] vendor script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Removing ./r characters prior to running vendor.sh fixed this problem:

RUN sed $'s/\r$//' ./scripts/vendor.sh > ./scripts/vendor.sh

tl;dr use node:11 as a base image and remove ./r characters from the vendor script to get Docker compose working

@bryik
Copy link
Contributor Author

bryik commented Mar 11, 2019

I can do a PR, if desired.

@domoritz
Copy link
Member

That would be great. Thanks!

bryik added a commit to bryik/editor that referenced this issue Mar 11, 2019
- Use Debian as base image as Alpine Linux does not currently work with pre-built canvas binaries

- Update packages before installing rsync (also bash package no longer needs to be installed)

- Remove '/r' characters from vendor.sh
domoritz pushed a commit that referenced this issue Mar 11, 2019
- Use Debian as base image as Alpine Linux does not currently work with pre-built canvas binaries

- Update packages before installing rsync (also bash package no longer needs to be installed)

- Remove '/r' characters from vendor.sh
@bryik
Copy link
Contributor Author

bryik commented Mar 13, 2019

This was fixed in: #261

@bryik bryik closed this as completed Mar 13, 2019
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

2 participants