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

gatsby-plugin-sharp error #7

Closed
grzegorz-bielski opened this issue Jul 2, 2018 · 2 comments
Closed

gatsby-plugin-sharp error #7

grzegorz-bielski opened this issue Jul 2, 2018 · 2 comments

Comments

@grzegorz-bielski
Copy link

Hi, I tried to run my gatsby project that uses gatsby-plugin-sharp, I typed in:

docker run -it --rm -v $(pwd)/site:/site -p 8000:8000 aripalo/gatsby-docker develop

but I'm getting following error:

Error: Error loading shared library /site/node_modules/sharp/build/Release/sharp.node: Exec format error

Everything is working fine when I'm starting a new project without mentioned plugin. Does anyone know what I'm doing wrong?

@polarathene
Copy link

polarathene commented Dec 18, 2018

I just started to run this docker image, and noticed my terminal output states the following:

Error: 'linux-x64' binaries cannot be used on the 'linuxmusl-x64' platform. Please remove the 'node_modules/sharp/vendor' directory an d run 'npm install'.

error GraphQL Error Unknown field childImageSharp on type File

/site/src/components/image.js
21:11 error Cannot query field "childImageSharp" on type "File" graphql/template-strings

So it might be due to the first error about musl(alpine linux as base I assume). Changing to another base image that doesn't use musl but libc like most would fix that or recompiling the binary modules. Alpine would have been chosen for achieving a small filesize in the docker image file.

EDIT: Nevermind, might have been something with the docker image or from me running npm install for a new package I added on my host(out of the container).

No issues with the binaries they're compiled at install, I was installing them on Linux host(libc) vs in the container(musl).

Deleted the node_modules directory and went into my container docker exec -it container_name_here /bin/sh to run yarn to reinstall everything. Restarted the container, it mentioned something about one or more plugins having changed so it deleted the cache folder.

There is two deprecations mentioned though, perhaps due to age of docker image and files it uses?, not sure:

boundActionCreators is deprecated. Please use actions instead. For migration instructions, see https://gatsby.app/boundActionCreators

pathContext is deprecated. Please use pageContext instead. For migration instructions, see https://gatsby.app/pathContext

@mastacheata
Copy link

The sharp plugin depends on a bunch of system libraries not shipping with node 9.5 alpine image.
As this docker image doesn't install any additional dependencies and hasn't been updated in 2 years, that's to be expected.
You're better off copying the entry.sh file and creating your own docker container based on a more recent nodejs build and installing the required libGL version.

@grzegorz-bielski grzegorz-bielski closed this as not planned Won't fix, can't repro, duplicate, stale Mar 24, 2024
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

3 participants