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

Mac M1 yarn add sharp #2891

Closed
goodboyMa opened this issue Sep 16, 2021 · 11 comments
Closed

Mac M1 yarn add sharp #2891

goodboyMa opened this issue Sep 16, 2021 · 11 comments

Comments

@goodboyMa
Copy link

goodboyMa commented Sep 16, 2021

Did you see the documentation relating to installation?
YES
Have you ensured the architecture and platform of Node.js used for npm install is the same as the architecture and platform of Node.js used at runtime?
yes
Are you using the latest version? Is the version currently in use as reported by npm ls sharp the same as the latest version as reported by npm view sharp dist-tags.latest?
yes
If you are using npm v6 or earlier and installing as a root or sudo user, have you tried with the npm install --unsafe-perm flag?
latest node
If you are using npm v7, does the user running npm install own the directory it is run in?
npm install sharp@v0.29.1
If you are using the ignore-scripts feature of npm, have you tried with the npm install --ignore-scripts=false flag?

What is the complete output of running npm install --verbose sharp? Have you checked this output for useful error messages?

What is the output of running npx envinfo --binaries --system?

9957 verbose argv "/opt/homebrew/Cellar/node/16.2.0/bin/node" "/opt/homebrew/bin/npm" "install" "sharp"
9958 verbose node v16.2.0
9959 verbose npm v7.13.0
9960 error code 1
9961 error path /Users/hyy/Desktop/gitlab/masterweb/node_modules/sharp
9962 error command failed
9963 error command sh -c node-gyp rebuild
9964 error TOUCH Release/obj.target/libvips-cpp.stamp
9964 error CC(target) Release/obj.target/nothing/node_modules/node-addon-api/nothing.o
9964 error LIBTOOL-STATIC Release/nothing.a
9964 error CXX(target) Release/obj.target/sharp-darwin-arm64v8/src/common.o
9965 error gyp info it worked if it ends with ok
9965 error gyp info using node-gyp@3.8.0
9965 error gyp info using node@16.2.0 | darwin | arm64
9965 error (node:46437) [DEP0150] DeprecationWarning: Setting process.config is deprecated. In the future the property will be read-only.
9965 error (Use node --trace-deprecation ... to show where the warning was created)
9965 error gyp info spawn /usr/bin/python2
9965 error gyp info spawn args [
9965 error gyp info spawn args '/Users/hyy/Desktop/gitlab/masterweb/node_modules/node-gyp/gyp/gyp_main.py',
9965 error gyp info spawn args 'binding.gyp',
9965 error gyp info spawn args '-f',
9965 error gyp info spawn args 'make',
9965 error gyp info spawn args '-I',
9965 error gyp info spawn args '/Users/hyy/Desktop/gitlab/masterweb/node_modules/sharp/build/config.gypi',
9965 error gyp info spawn args '-I',
9965 error gyp info spawn args '/Users/hyy/Desktop/gitlab/masterweb/node_modules/node-gyp/addon.gypi',
9965 error gyp info spawn args '-I',
9965 error gyp info spawn args '/Users/hyy/.node-gyp/16.2.0/include/node/common.gypi',
9965 error gyp info spawn args '-Dlibrary=shared_library',
9965 error gyp info spawn args '-Dvisibility=default',
9965 error gyp info spawn args '-Dnode_root_dir=/Users/hyy/.node-gyp/16.2.0',
9965 error gyp info spawn args '-Dnode_gyp_dir=/Users/hyy/Desktop/gitlab/masterweb/node_modules/node-gyp',
9965 error gyp info spawn args '-Dnode_lib_file=/Users/hyy/.node-gyp/16.2.0/<(target_arch)/node.lib',
9965 error gyp info spawn args '-Dmodule_root_dir=/Users/hyy/Desktop/gitlab/masterweb/node_modules/sharp',
9965 error gyp info spawn args '-Dnode_engine=v8',
9965 error gyp info spawn args '--depth=.',
9965 error gyp info spawn args '--no-parallel',
9965 error gyp info spawn args '--generator-output',
9965 error gyp info spawn args 'build',
9965 error gyp info spawn args '-Goutput_dir=.'
9965 error gyp info spawn args ]
9965 error gyp info spawn make
9965 error gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
9965 error warning: /Library/Developer/CommandLineTools/usr/bin/libtool: archive library: Release/nothing.a the table of contents is empty (no object file members in the library define global symbols)
9965 error ../src/common.cc:24:10: fatal error: 'vips/vips8' file not found
9965 error #include <vips/vips8>
9965 error ^~~~~~~~~~~~
9965 error 1 error generated.
9965 error make: *** [Release/obj.target/sharp-darwin-arm64v8/src/common.o] Error 1
9965 error gyp ERR! build error
9965 error gyp ERR! stack Error: make failed with exit code: 2
9965 error gyp ERR! stack at ChildProcess.onExit (/Users/hyy/Desktop/gitlab/masterweb/node_modules/node-gyp/lib/build.js:262:23)
9965 error gyp ERR! stack at ChildProcess.emit (node:events:365:28)
9965 error gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
9965 error gyp ERR! System Darwin 20.3.0
9965 error gyp ERR! command "/opt/homebrew/Cellar/node/16.2.0/bin/node" "/Users/hyy/Desktop/gitlab/masterweb/node_modules/.bin/node-gyp" "rebuild"
9965 error gyp ERR! cwd /Users/hyy/Desktop/gitlab/masterweb/node_modules/sharp
9965 error gyp ERR! node -v v16.2.0
9965 error gyp ERR! node-gyp -v v3.8.0
9965 error gyp ERR! not ok
9966 verbose exit 1

@lovell
Copy link
Owner

lovell commented Sep 16, 2021

Please can you provide the complete output of running npm install --verbose sharp? (There will be additional information logged before the output provided above.)

@goodboyMa
Copy link
Author

Please can you provide the complete output of running npm install --verbose sharp? (There will be additional information logged before the output provided above.)

sharp_install.txt
Yeah

@lovell
Copy link
Owner

lovell commented Sep 16, 2021

Thanks, it looks like there's still some missing output.

My best guess would be that there was some kind of error downloading the prebuilt binaries. I notice you're using an alternative npm registry based in China - did you see https://sharp.pixelplumbing.com/install#chinese-mirror ? Have you tried using this?

Are there any other npm-based environment variables? What is the output of running npm config get?

@goodboyMa
Copy link
Author

Thanks, it looks like there's still some missing output.

My best guess would be that there was some kind of error downloading the prebuilt binaries. I notice you're using an alternative npm registry based in China - did you see https://sharp.pixelplumbing.com/install#chinese-mirror ? Have you tried using this?

Are there any other npm-based environment variables? What is the output of running npm config get?
a.txt
Same Error😭

@lovell
Copy link
Owner

lovell commented Sep 17, 2021

Please can you make sure you're using the latest version of npm v7 (currently v7.24.0).

There's still missing output, and I know there have previously been bugs in npm (and yarn) that cause installation log suppression, which is what I suspect might be happening here. Is there any more information in the referenced log file /Users/hyy/.npm/_logs/2021-09-16T11_01_56_829Z-debug.log ?

@goodboyMa
Copy link
Author

Please can you make sure you're using the latest version of npm v7 (currently v7.24.0).

There's still missing output, and I know there have previously been bugs in npm (and yarn) that cause installation log suppression, which is what I suspect might be happening here. Is there any more information in the referenced log file /Users/hyy/.npm/_logs/2021-09-16T11_01_56_829Z-debug.log ?

  1. npm -v : 7.24.0
    2021-09-18T02_19_13_277Z-debug.log
    Many Thanks

@lovell
Copy link
Owner

lovell commented Sep 18, 2021

Is it possible that you've installed vips via Homebrew? If so, please can you try removing it using brew uninstall vips

@lovell
Copy link
Owner

lovell commented Sep 21, 2021

I think you've run into npm/cli#2606 as it would totally explain why npm v7 is trying to run node-gyp and not the install script it is supposed to.

Please can you try running npx fix-has-install-script in the /Users/hyy/Desktop/gitlab/masterweb directory.

@lovell
Copy link
Owner

lovell commented Oct 3, 2021

This is a bug in npm v7 - please subscribe to npm/cli#2606 for updates.

@lovell lovell closed this as completed Oct 3, 2021
@dzeitman
Copy link

dzeitman commented Nov 8, 2021

Having trouble installing sharp - tried yarn add --platform=darwin --arch=arm64 sharp

no dice.

@lovell
Copy link
Owner

lovell commented Nov 8, 2021

@dzeitman Please open a new installation issue and answer all of the questions. https://github.com/lovell/sharp/issues/new?assignees=&labels=installation&template=installation.md

Repository owner locked and limited conversation to collaborators Nov 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants