sharp icon indicating copy to clipboard operation
sharp copied to clipboard

Build fails on Windows on ARM; Win32 arm64

Open jonshipmansmc opened this issue 3 years ago • 8 comments

image

  • [x] I have read the documentation relating to installation.
  • [x] I have ensured that 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.

Are you using the latest version of sharp?

  • [x] I am using the latest version of sharp as reported by npm view sharp dist-tags.latest.

What is the complete output of running npm install --verbose --foreground-scripts sharp in an empty directory?

2023-03-17T17_37_37_241Z-debug-0.log

What is the output of running npx envinfo --binaries --system --npmPackages=sharp --npmGlobalPackages=sharp?

System: OS: Windows 10 10.0.22621 CPU: (8) arm64 Microsoft SQ1 @ 3.0 GHz Memory: 871.60 MB / 15.47 GB Binaries: Node: 18.11.0 - C:\Program Files\node\default\node.EXE Yarn: 1.22.19 - C:\Program Files\node\default\yarn.CMD npm: 8.19.2 - C:\Program Files\node\default\npm.CMD

jonshipmansmc avatar Mar 17 '23 17:03 jonshipmansmc

A search for the "cannot open input file Delayimp.lib" error message suggests this might be a Visual Studio misconfiguration/corruption e.g. https://stackoverflow.com/questions/26410604/cannot-open-input-file-delayimp-lib

lovell avatar Mar 18 '23 14:03 lovell

Looks like the error is with nothing.vcxproj (though that would make it an issue in the node-addon-api package). Can someone confirm and I can take the issue over there?

It's creating a node_modules\sharp\node-addon-api\nothing.vcxproj file with an incorrect build target. My machine has Delayimp.lib for all three arches (arm64, x86, x64) but I'm using an arm64 build of node (which would prevent an x86 lib from loading).

Unless there is a configuration param to specify the architecture when using node-addon-api?

jonshipmansmc avatar Mar 20 '23 16:03 jonshipmansmc

The npm_config_arch setting (e.g. via the npm --arch flag) controls which architecture is passed to node-gyp and therefore used at compile time.

IIRC the Visual Studio link.exe doesn't allow control over architecture but instead assumes that of the first binary it sees.

I'm unsure where the problem lies here, and don't have access to a ARM64 Windows environment to reproduce.

lovell avatar Mar 20 '23 18:03 lovell

@jonshipmansmc Were you able to make any progress with this?

lovell avatar Apr 21 '23 08:04 lovell

Sorry no, I've been too busy as of late

jonshipman avatar Apr 21 '23 13:04 jonshipman

Closing due to inactivity but please feel free to reopen if/when further help is required.

lovell avatar May 11 '23 10:05 lovell

problem here is the Sharp, i have the same problem in the Mac due to Arm, can't run Strapi here due to it. Using latest versions of Node, if not mistaken only works in the Node 14.

bgomes-bacardi avatar Jul 28 '23 08:07 bgomes-bacardi

@bgomes-bacardi If you're still having problems, please open a new installation issue and answer all of the questions. https://github.com/lovell/sharp/issues/new?assignees=&labels=installation&projects=&template=installation.md

lovell avatar Jul 28 '23 09:07 lovell