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

Failed to install sharp on termux #4161

Closed
JaydenWooCn opened this issue Jul 16, 2024 · 13 comments
Closed

Failed to install sharp on termux #4161

JaydenWooCn opened this issue Jul 16, 2024 · 13 comments

Comments

@JaydenWooCn
Copy link

I develop in termux linux.
when I try to install @nuxt/image in my nuxt project, error: sharp: Installation Prebuilt libvips 8.14.5 binaries are not yet available for android-arm64v8

then I try to run: npm install --unsafe-perm --platform=linux sharp, error:
sharp: Installation error: EACCES: permission denied, link '/data/data/com.termux/files/home/projects/greenroom/greenroom/node_modules/ipx/node_modules/sharp/vendor/8.14.5/linux-arm64v8/include/libpng16/pngconf.h' -> '/data/data/com.termux/files/home/projects/greenroom/greenroom/node_modules/ipx/node_modules/sharp/vendor/8.14.5/linux-arm64v8/include/pngconf.h'

@lovell
Copy link
Owner

lovell commented Jul 16, 2024

Please upgrade to the latest version of ipx and therefore the latest version of sharp.

For Termux, you'll also need to configure npm to ensure it knows the OS is Linux using the npm install --os=linux flag.

https://sharp.pixelplumbing.com/install#cross-platform

@JaydenWooCn
Copy link
Author

JaydenWooCn commented Jul 16, 2024

when I run npm install --os=linux sharp, encountered error as below:

Package xproto was not found in the pkg-config search path.
Perhaps you should add the directory containing `xproto.pc' to the PKG_CONFIG_PATH environment variable Package 'xproto', required by 'xrender', not found gyp: Undefined variable android_ndk_path in binding.gyp while trying to load binding.gyp

I afraid Termux does not directly support X11 libraries and related packages like xproto.

please further help!

@ahtashamabbasse

This comment was marked as off-topic.

@lovell
Copy link
Owner

lovell commented Jul 16, 2024

@ahtashamabbasse This issue relates to Termux. If you're still having problems, please open a new installation issue and answer all of the questions.

@lovell
Copy link
Owner

lovell commented Jul 16, 2024

@JaydenWooCn Please can you provide the complete output of running the following in an empty directory.

npm install --os=linux --verbose --foreground-scripts sharp

@JaydenWooCn
Copy link
Author

Thank you for your help, it seems that it work. so waht should I do next step?

npm install --os=linux --verbose --foreground-scripts sharp
npm verbose cli /data/data/com.termux/files/usr/bin/node /data/data/com.termux/files/usr/bin/npm
npm info using npm@10.8.1
npm info using node@v22.4.1
npm verbose title npm install sharp
npm verbose argv "install" "--os" "linux" "--loglevel" "verbose" "--foreground-scripts" "sharp"
npm verbose logfile logs-max:10 dir:/data/data/com.termux/files/home/.npm/_logs/2024-07-16T12_05_00_103Z-
npm verbose logfile /data/data/com.termux/files/home/.npm/_logs/2024-07-16T12_05_00_103Z-debug-0.log
npm http fetch GET 200 https://registry.npmjs.org/sharp 507ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/semver 308ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/color 349ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/detect-libc 434ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-darwin-x64 180ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-libvips-darwin-x64 208ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-libvips-linux-arm 184ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-libvips-darwin-arm64 402ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-libvips-linux-s390x 132ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-libvips-linux-x64 140ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-libvips-linuxmusl-x64 157ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-linux-arm 140ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-linux-arm64 206ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-darwin-arm64 1509ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-linux-s390x 144ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-linux-x64 172ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-linuxmusl-arm64 152ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-linuxmusl-x64 145ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-wasm32 123ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-libvips-linux-arm64 1314ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-win32-x64 140ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-libvips-linuxmusl-arm64 1316ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/@img%2fsharp-win32-ia32 1281ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/color-convert 104ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/color-string 135ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/@emnapi%2fruntime 142ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/tslib 97ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/simple-swizzle 86ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/color-name 100ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/color-name 144ms (cache revalidated)
npm http fetch GET 200 https://registry.npmjs.org/is-arrayish 90ms (cache revalidated)
npm verbose reify failed optional dependency /data/data/com.termux/files/home/projects/demo/node_modules/@img/sharp-win32-x64
npm verbose reify failed optional dependency /data/data/com.termux/files/home/projects/demo/node_modules/@img/sharp-win32-ia32
npm verbose reify failed optional dependency /data/data/com.termux/files/home/projects/demo/node_modules/@img/sharp-wasm32
npm verbose reify failed optional dependency /data/data/com.termux/files/home/projects/demo/node_modules/@emnapi/runtime
npm verbose reify failed optional dependency /data/data/com.termux/files/home/projects/demo/node_modules/tslib
npm verbose reify failed optional dependency /data/data/com.termux/files/home/projects/demo/node_modules/@img/sharp-linuxmusl-x64
npm verbose reify failed optional dependency /data/data/com.termux/files/home/projects/demo/node_modules/@img/sharp-linuxmusl-arm64
npm verbose reify failed optional dependency /data/data/com.termux/files/home/projects/demo/node_modules/@img/sharp-linux-x64
npm verbose reify failed optional dependency /data/data/com.termux/files/home/projects/demo/node_modules/@img/sharp-linux-s390x
npm verbose reify failed optional dependency /data/data/com.termux/files/home/projects/demo/node_modules/@img/sharp-linux-arm64
npm verbose reify failed optional dependency /data/data/com.termux/files/home/projects/demo/node_modules/@img/sharp-linux-arm
npm verbose reify failed optional dependency /data/data/com.termux/files/home/projects/demo/node_modules/@img/sharp-libvips-linuxmusl-x64
npm verbose reify failed optional dependency /data/data/com.termux/files/home/projects/demo/node_modules/@img/sharp-libvips-linuxmusl-arm64
npm verbose reify failed optional dependency /data/data/com.termux/files/home/projects/demo/node_modules/@img/sharp-libvips-linux-x64
npm verbose reify failed optional dependency /data/data/com.termux/files/home/projects/demo/node_modules/@img/sharp-libvips-linux-s390x
npm verbose reify failed optional dependency /data/data/com.termux/files/home/projects/demo/node_modules/@img/sharp-libvips-linux-arm64
npm verbose reify failed optional dependency /data/data/com.termux/files/home/projects/demo/node_modules/@img/sharp-libvips-linux-arm
npm verbose reify failed optional dependency /data/data/com.termux/files/home/projects/demo/node_modules/@img/sharp-libvips-darwin-x64
npm verbose reify failed optional dependency /data/data/com.termux/files/home/projects/demo/node_modules/@img/sharp-libvips-darwin-arm64
npm verbose reify failed optional dependency /data/data/com.termux/files/home/projects/demo/node_modules/@img/sharp-darwin-x64
npm verbose reify failed optional dependency /data/data/com.termux/files/home/projects/demo/node_modules/@img/sharp-darwin-arm64
npm info run sharp@0.33.4 install node_modules/sharp node install/check

sharp@0.33.4 install
node install/check

sharp: Detected globally-installed libvips v8.15.2
sharp: Attempting to build from source via node-gyp
sharp: Please add node-addon-api to your dependencies
npm info run sharp@0.33.4 install { code: 0, signal: null }

added 9 packages in 7s

1 package is looking for funding
run npm fund for details
npm verbose cwd /data/data/com.termux/files/home/projects/demo
npm verbose os Linux 5.10.177-android12-9-00001-g219d8dfbba07-ab10551810
npm verbose node v22.4.1
npm verbose npm v10.8.1
npm verbose exit 0
npm info ok

@JaydenWooCn
Copy link
Author

JaydenWooCn commented Jul 18, 2024

@lovell I have you show you the script output, please check. could you give me further help? any suggestion? Thank you!

@lovell
Copy link
Owner

lovell commented Jul 18, 2024

In your first comment you provided an error seen when installing a version of sharp that is not the latest. From your most recent comment it looks like installing the latest version works.

It looks like you're using sharp through the ipx dependency, so therefore please upgrade to the latest version of ipx and therefore the latest version of sharp.

@JaydenWooCn
Copy link
Author

This is a nuxtjs project, have a @nuxt/image component there.
I have check there are exist ipx3.0.1(latest) and sharp0.33.4(latest) in the node_modules folder.
When I run npm install --os=linux, the output as below:


sharp@0.32.6 install
(node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node install/dll-copy)

sharp: Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.14.5/libvips-8.14.5-android-arm64v8.tar.br
sharp: Installation error: Prebuilt libvips 8.14.5 binaries are not yet available for android-arm64v8
sharp: Please see https://sharp.pixelplumbing.com/install for required dependencies

postinstall
nuxt prepare

✔ Types generated in .nuxt 3:45:26 PM

added 5 packages, and audited 685 packages in 20s

138 packages are looking for funding
run npm fund for details

found 0 vulnerabilities

I think some package dependence on sharp@0.32.6, so it want to install that version, but I don't sknow which package dependence on it. So could you give me any suggesion?

@JaydenWooCn
Copy link
Author

JaydenWooCn commented Jul 19, 2024

Even when I run this script npm install --os=linux --save sharp@0.33.4 specific exact
the latest version, it still try to install the older version 0.32.6, this is the output:

npm install --os=linux --save sharp@0.33.4

sharp@0.33.4 install
node install/check

sharp@0.32.6 install
(node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node install/dll-copy)

sharp: Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.14.5/libvips-8.14.5-android-arm64v8.tar.br
sharp: Installation error: Prebuilt libvips 8.14.5 binaries are not yet available for android-arm64v8
sharp: Please see https://sharp.pixelplumbing.com/install for required dependencies

sharp@0.32.6 install
(node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node install/dll-copy)

sharp: Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.14.5/libvips-8.14.5-android-arm64v8.tar.br
sharp: Installation error: Prebuilt libvips 8.14.5 binaries are not yet available for android-arm64v8
sharp: Please see https://sharp.pixelplumbing.com/install for required dependencies
npm error code 1
npm error path /data/data/com.termux/files/home/projects/greenroom/greenroom/node_modules/ipx/node_modules/sharp
npm error command failed
npm error command sh -c (node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node install/dll-copy)
npm error A complete log of this run can be found in: /data/data/com.termux/files/home/.npm/_logs/2024-07-19T02_46_50_242Z-debug-0.log

@lovell
Copy link
Owner

lovell commented Jul 19, 2024

What is the output of running npm ls sharp in the /data/data/com.termux/files/home/projects/greenroom/greenroom directory?

@JaydenWooCn
Copy link
Author

JaydenWooCn commented Jul 19, 2024

@lovell This the output, please check.

npm ls sharp
nuxt-app@ /data/data/com.termux/files/home/projects/greenroom/greenroom
├─┬ ipx@3.0.1 invalid: "^2.1.0" from node_modules/@nuxt/image
│ └── sharp@0.33.4 deduped
└── sharp@0.33.4

So I need to set the ipx version to ipx3.0.1(latest), right? I have a try right now

@JaydenWooCn
Copy link
Author

JaydenWooCn commented Jul 19, 2024

Change the ipx to the latest version in @nuxt/image package.json solve my problem. Thank you very much lovell! I can't solve it without your help!

@lovell lovell closed this as completed Jul 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants