Closed Glutch closed 3 years ago
This install log includes dependencies that are unrelated to sharp. Please can you provide the output of running npm install --verbose sharp
in an empty directory.
This install log includes dependencies that are unrelated to sharp. Please can you provide the output of running
npm install --verbose sharp
in an empty directory.
That worked. Then i removed node_modules from my main project, removed package.json and installed every module manually independantly. No errors.
But when i run the script
Error:
Something went wrong installing the "sharp" module
The specified procedure could not be found.
\\?\C:\Users\user\Documents\dev\javascript\xxxxx\node_modules\sharp\build\Release\sharp.node
- Remove the "node_modules/sharp" directory then run
"npm install --ignore-scripts=false --verbose" and look for errors
- Consult the installation documentation at https://sharp.pixelplumbing.com/install
- Search for this error at https://github.com/lovell/sharp/issues
at Object.<anonymous> (C:\Users\user\Documents\dev\javascript\xxxxx\node_modules\sharp\lib\constructor.js:34:9)
at Module._compile (node:internal/modules/cjs/loader:1108:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)
at Module.load (node:internal/modules/cjs/loader:973:32)
at Function.Module._load (node:internal/modules/cjs/loader:813:14)
at Module.require (node:internal/modules/cjs/loader:997:19)
at require (node:internal/modules/cjs/helpers:92:18)
at Object.<anonymous> (C:\Users\user\Documents\dev\javascript\xxxxx\node_modules\sharp\lib\index.js:3:15)
at Module._compile (node:internal/modules/cjs/loader:1108:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)
at Module.load (node:internal/modules/cjs/loader:973:32)
at Function.Module._load (node:internal/modules/cjs/loader:813:14)
at Module.require (node:internal/modules/cjs/loader:997:19)
at require (node:internal/modules/cjs/helpers:92:18)
at Object.<anonymous> (C:\Users\user\Documents\dev\javascript\xxxxx\api\image.js:3:15)
at Module._compile (node:internal/modules/cjs/loader:1108:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)
at Module.load (node:internal/modules/cjs/loader:973:32)
at Function.Module._load (node:internal/modules/cjs/loader:813:14)
at Module.require (node:internal/modules/cjs/loader:997:19)
at require (node:internal/modules/cjs/helpers:92:18)
at Object.<anonymous> (C:\Users\user\Documents\dev\javascript\xxxxx\api\reddit.js:5:31)
And heres the output of running --ignore-scripts etc as the error suggests
PS C:\Users\user\Documents\dev\javascript\xxxxx> npm install --ignore-scripts=false --verbose
npm verb cli [
npm verb cli 'C:\\Program Files\\nodejs\\node.exe',
npm verb cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
npm verb cli 'install',
npm verb cli '--ignore-scripts=false',
npm verb cli '--verbose'
npm verb cli ]
npm info using npm@7.4.0
npm info using node@v15.6.0
npm timing config:load:defaults Completed in 1ms
npm timing config:load:file:C:\Program Files\nodejs\node_modules\npm\npmrc Completed in 1ms
npm timing config:load:builtin Completed in 2ms
npm timing config:load:cli Completed in 2ms
npm timing config:load:env Completed in 0ms
npm timing config:load:file:C:\Users\user\Documents\dev\javascript\xxxxx\.npmrc Completed in 0ms
npm timing config:load:project Completed in 2ms
npm timing config:load:file:C:\Users\user\.npmrc Completed in 0ms
npm timing config:load:user Completed in 0ms
npm timing config:load:file:C:\Users\user\AppData\Roaming\npm\etc\npmrc Completed in 1ms
npm timing config:load:global Completed in 1ms
npm timing config:load:cafile Completed in 0ms
npm timing config:load:validate Completed in 0ms
npm timing config:load:setUserAgent Completed in 1ms
npm timing config:load:setEnvs Completed in 0ms
npm timing config:load Completed in 9ms
npm verb npm-session 3335308c607328c9
npm timing npm:load Completed in 45ms
npm timing arborist:ctor Completed in 1ms
npm timing idealTree:init Completed in 208ms
npm timing idealTree:userRequests Completed in 0ms
npm timing idealTree:#root Completed in 0ms
npm timing idealTree:buildDeps Completed in 22ms
npm timing idealTree:fixDepFlags Completed in 0ms
npm timing idealTree Completed in 239ms
npm timing reify:loadTrees Completed in 496ms
npm timing reify:diffTrees Completed in 17ms
npm timing reify:retireShallow Completed in 0ms
npm timing reify:createSparse Completed in 2ms
npm timing reify:loadBundles Completed in 0ms
npm timing reifyNode:node_modules/sharp/node_modules/prebuild-install/node_modules/simple-get Completed in 75ms
npm timing reifyNode:node_modules/sharp/node_modules/simple-get/node_modules/decompress-response Completed in 75ms
npm timing reifyNode:node_modules/sharp/node_modules/simple-get Completed in 76ms
npm timing reifyNode:node_modules/sharp/node_modules/mimic-response Completed in 76ms
npm timing reifyNode:node_modules/sharp/node_modules/prebuild-install Completed in 82ms
npm timing reifyNode:node_modules/sharp/node_modules/semver Completed in 143ms
npm timing reifyNode:node_modules/sharp Completed in 148ms
npm timing reify:unpack Completed in 166ms
npm timing build:queue Completed in 1ms
npm timing build:link:node_modules/sharp/node_modules/prebuild-install Completed in 4ms
npm timing build:link:node_modules/sharp/node_modules/semver Completed in 4ms
npm timing build:link Completed in 4ms
npm info run sharp@0.27.0 install node_modules/sharp (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)
npm http fetch POST 200 https://registry.npmjs.org/-/npm/v1/security/advisories/bulk 1081ms
npm timing auditReport:getReport Completed in 1084ms
npm timing metavuln:cache:get:security-advisory:yargs-parser:wggLna/MWf0SS4RVuOVF5G/ZiDVijxAaiM9wM/rCy1bMks+TGpf2QGl8AGla/tvYjYRp5H0QrBwyOo1m0VbBKg== Completed in 10ms
npm timing metavuln:cache:get:security-advisory:url-regex:Bz3I22ZGpMVfaxKbT0guoH+i78yQWFijf4NkPQRblZCzT5myiMnfNtnIKfrMq19IFLiwfx8ykZH5OPZcKrW1mg== Completed in 22ms
npm http fetch GET 304 https://registry.npmjs.org/yargs-parser 83ms (from cache)
npm timing metavuln:packument:yargs-parser Completed in 87ms
npm timing metavuln:load:security-advisory:yargs-parser:1500 Completed in 1ms
npm timing metavuln:calculate:security-advisory:yargs-parser:1500 Completed in 89ms
npm http fetch GET 304 https://registry.npmjs.org/url-regex 300ms (from cache)
npm timing metavuln:packument:url-regex Completed in 300ms
npm timing metavuln:load:security-advisory:url-regex:1550 Completed in 0ms
npm timing metavuln:calculate:security-advisory:url-regex:1550 Completed in 301ms
npm timing metavuln:cache:get:security-advisory:cliss:VbDNVJ2/26dAESAMCab0yi8zK7SZEIQ9OgzZFM2M6ULBqdDf4mVfufYa/qY/zeIUUW924F2Avkw4OdWx7Lim1Q== Completed in 2ms
npm http fetch GET 200 https://registry.npmjs.org/cliss 25ms (from cache)
npm timing metavuln:packument:cliss Completed in 26ms
npm timing metavuln:load:security-advisory:cliss:wggLna/MWf0SS4RVuOVF5G/ZiDVijxAaiM9wM/rCy1bMks+TGpf2QGl8AGla/tvYjYRp5H0QrBwyOo1m0VbBKg== Completed in 0ms
npm timing metavuln:calculate:security-advisory:cliss:wggLna/MWf0SS4RVuOVF5G/ZiDVijxAaiM9wM/rCy1bMks+TGpf2QGl8AGla/tvYjYRp5H0QrBwyOo1m0VbBKg== Completed in 27ms
npm info run sharp@0.27.0 install { code: 0, signal: null }
npm timing build:run:install:node_modules/sharp Completed in 1257ms
npm timing build:run:install Completed in 1258ms
npm timing build:deps Completed in 1265ms
npm timing build Completed in 1266ms
npm timing reify:build Completed in 1266ms
npm timing reify:trash Completed in 0ms
npm http fetch GET 200 https://registry.npmjs.org/magicli 90ms (from cache)
npm timing metavuln:packument:magicli Completed in 90ms
npm timing metavuln:cache:get:security-advisory:magicli:KU5p3+1GRXK+UCgcqWuomIcftXFQ3ApiukXCmR1qOGRNf8kzta0lNGGBWDcOtWlcQQ64rrEjz9RiwQMRqVO0wg== Completed in 90ms
npm timing metavuln:load:security-advisory:magicli:VbDNVJ2/26dAESAMCab0yi8zK7SZEIQ9OgzZFM2M6ULBqdDf4mVfufYa/qY/zeIUUW924F2Avkw4OdWx7Lim1Q== Completed in 0ms
npm timing metavuln:calculate:security-advisory:magicli:VbDNVJ2/26dAESAMCab0yi8zK7SZEIQ9OgzZFM2M6ULBqdDf4mVfufYa/qY/zeIUUW924F2Avkw4OdWx7Lim1Q== Completed in 92ms
npm timing reify:save Completed in 71ms
npm timing metavuln:cache:get:security-advisory:inspect-function:XNYYGr89Mll/p3J9L5OnWedVyHxclCQ9oYoqOdSK4cjaRg85H3ATSVBBxWX5QCPoORmOOiR6gU0iKPTK2jF3xg== Completed in 17ms
npm http fetch GET 200 https://registry.npmjs.org/image-data-uri 29ms (from cache)
npm timing metavuln:packument:image-data-uri Completed in 29ms
npm timing metavuln:cache:get:security-advisory:image-data-uri:a1V7V/CvlmS3xof1r8zyJusOm3oHKT4oOjwMhRuHv24L/smuMSzHX7wgUzs9ohEahaeglxoOrIjz9+n3GGTaSQ== Completed in 30msnpm timing metavuln:load:security-advisory:image-data-uri:KU5p3+1GRXK+UCgcqWuomIcftXFQ3ApiukXCmR1qOGRNf8kzta0lNGGBWDcOtWlcQQ64rrEjz9RiwQMRqVO0wg== Completed in 0ms
npm timing metavuln:calculate:security-advisory:image-data-uri:KU5p3+1GRXK+UCgcqWuomIcftXFQ3ApiukXCmR1qOGRNf8kzta0lNGGBWDcOtWlcQQ64rrEjz9RiwQMRqVO0wg== Completed in 31msnpm http fetch GET 304 https://registry.npmjs.org/inspect-function 90ms (from cache)
npm timing metavuln:packument:inspect-function Completed in 93ms
npm timing metavuln:load:security-advisory:inspect-function:KU5p3+1GRXK+UCgcqWuomIcftXFQ3ApiukXCmR1qOGRNf8kzta0lNGGBWDcOtWlcQQ64rrEjz9RiwQMRqVO0wg== Completed in 0ms
npm timing metavuln:calculate:security-advisory:inspect-function:KU5p3+1GRXK+UCgcqWuomIcftXFQ3ApiukXCmR1qOGRNf8kzta0lNGGBWDcOtWlcQQ64rrEjz9RiwQMRqVO0wg== Completed in 94ms
npm http fetch GET 200 https://registry.npmjs.org/inspect-property 3ms (from cache)
npm timing metavuln:packument:inspect-property Completed in 3ms
npm timing metavuln:cache:get:security-advisory:inspect-property:OwJWNngcXMbZb616fMwa2IuRVQmiWhvW+F55agdSwnPzy9vIz9gX4snICkqkuvmXrlpx/sRktRjBvhjTWXTKyQ== Completed in 4ms
npm timing metavuln:load:security-advisory:inspect-property:XNYYGr89Mll/p3J9L5OnWedVyHxclCQ9oYoqOdSK4cjaRg85H3ATSVBBxWX5QCPoORmOOiR6gU0iKPTK2jF3xg== Completed in 0ms
npm timing metavuln:calculate:security-advisory:inspect-property:XNYYGr89Mll/p3J9L5OnWedVyHxclCQ9oYoqOdSK4cjaRg85H3ATSVBBxWX5QCPoORmOOiR6gU0iKPTK2jF3xg== Completed in 5ms
npm timing auditReport:init Completed in 528ms
npm timing reify:audit Completed in 1613ms
npm timing reify Completed in 2154ms
added 7 packages, and audited 644 packages in 2s
53 packages are looking for funding
run `npm fund` for details
6 vulnerabilities (5 low, 1 high)
To address issues that do not require attention, run:
npm audit fix
To address all issues possible (including breaking changes), run:
npm audit fix --force
Some issues need review, and may require choosing
a different dependency.
Run `npm audit` for details.
npm timing command:install Completed in 2217ms
npm verb exit 0
npm timing npm Completed in 2491ms
npm info ok
PS C:\Users\user\Documents\dev\javascript\xxxxx> node app
node-telegram-bot-api deprecated Automatic enabling of cancellation of promises is deprecated.
In the future, you will have to enable it yourself.
See https://github.com/yagop/node-telegram-bot-api/issues/319. node:internal\modules\cjs\loader:1108:14
C:\Users\user\Documents\dev\javascript\xxxxx\node_modules\sharp\lib\constructor.js:34
throw new Error(error);
^
Error:
Something went wrong installing the "sharp" module
The specified procedure could not be found.
\\?\C:\Users\user\Documents\dev\javascript\xxxxx\node_modules\sharp\build\Release\sharp.node
- Remove the "node_modules/sharp" directory then run
"npm install --ignore-scripts=false --verbose" and look for errors
- Consult the installation documentation at https://sharp.pixelplumbing.com/install
- Search for this error at https://github.com/lovell/sharp/issues
at Object.<anonymous> (C:\Users\user\Documents\dev\javascript\xxxxx\node_modules\sharp\lib\constructor.js:34:9)
at Module._compile (node:internal/modules/cjs/loader:1108:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)
at Module.load (node:internal/modules/cjs/loader:973:32)
at Function.Module._load (node:internal/modules/cjs/loader:813:14)
at Module.require (node:internal/modules/cjs/loader:997:19)
at require (node:internal/modules/cjs/helpers:92:18)
at Object.<anonymous> (C:\Users\user\Documents\dev\javascript\xxxxx\node_modules\sharp\lib\index.js:3:15)
at Module._compile (node:internal/modules/cjs/loader:1108:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)
at Module.load (node:internal/modules/cjs/loader:973:32)
at Function.Module._load (node:internal/modules/cjs/loader:813:14)
at Module.require (node:internal/modules/cjs/loader:997:19)
at require (node:internal/modules/cjs/helpers:92:18)
at Object.<anonymous> (C:\Users\user\Documents\dev\javascript\xxxxx\api\image.js:3:15)
at Module._compile (node:internal/modules/cjs/loader:1108:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)
at Module.load (node:internal/modules/cjs/loader:973:32)
at Function.Module._load (node:internal/modules/cjs/loader:813:14)
at Module.require (node:internal/modules/cjs/loader:997:19)
at require (node:internal/modules/cjs/helpers:92:18)
at Object.<anonymous> (C:\Users\user\Documents\dev\javascript\xxxxx\api\reddit.js:5:31)
I notice canvas
in the original list of dependencies. Windows+canvas+sharp is a combo that won't work.
I notice
canvas
in the original list of dependencies. Windows+canvas+sharp is a combo that won't work.
removing canvas worked! (i just changed from one windows computer to a brand new one, strange that the code worked on my old pc!)
thanks :)
Using canvas
on Windows requires GTK 2, which has been unmaintained for almost 10 years (and is therefore worth verifying for security vulnerabilities if it is to be used with untrusted input).
I added a section to the docs about this conflict via commit 98349bd. There's no workaround other than not using canvas
.
Does anybody know whether there is an alternative to node-canvas? I don't understand what's the point in building module on top of the ancient unmaintained software...
@lovell I don't think it is fair to blame node-canvas here. The information that node-canvas requires a 10 year old GTK 2 is simply wrong or not valid anymore. The prebuilt binary of node-canvas uses DLLs (like libpng, libjpeg and more) from a standard MSYS2 Mingw64 installation. I know node-canvas still tries to compile against libraries in a c:/gtk2 folder when no pre-built binary is found but this is not the way node-canvas works today and has nothing to do with this problem. I even compiled my own node-canvas against the latest dependency versions in MSYS2 MingW64 and run into the same problem.
One of the dependencies is libglib-2.0-0.dll. Sharp itself also contains this DLL file. Not sure with which environment Sharp is compiled on Windows but it looks like these two DLLs are simply not compatible even when they have the same version. When I load node-canvas before I load sharp then node-canvas works fine but sharp doesn't work anymore. When I load sharp first then node-canvas doesn't work. On Linux this isn't a problem because on Linux Sharp doesn't have a dependency on glib (I guess it is statically compiled into libvips). And maybe even if there were a shared glib in Sharp I guess Linux would be able to do the right thing.
I wonder why glib is not statically compiled into libvips on Windows. The libvips binary is huge so I guess it already contains a bunch of other statically linked libraries (like libjpeg for example). So why is glib a separate DLL?
Or can you give some insights how libvips and sharp are compiled on Windows? Visual Studio? Cygwin? MSYS2? And against which C runtime? msvcrt? ucrt? Maybe it helps compiling node-canvas dependencies in the same environment so the DLLs are compatible.
I wonder why glib is not statically compiled into libvips on Windows. The libvips binary is huge so I guess it already contains a bunch of other statically linked libraries (like libjpeg for example). So why is glib a separate DLL?
GLib isn't build statically on Windows to ensure compatibility with libvips' FFI bindings - see for example: https://github.com/kleisauke/net-vips/blob/master/src/NetVips/Interop/Libraries.Windows.cs
Or can you give some insights how libvips and sharp are compiled on Windows?
sharp uses the https://github.com/libvips/build-win64-mxe repository for this - see: https://github.com/lovell/sharp-libvips#windows
Visual Studio? Cygwin? MSYS2? And against which C runtime? msvcrt? ucrt? Maybe it helps compiling node-canvas dependencies in the same environment so the DLLs are compatible.
llvm-mingw and UCRT, which should match the CLANG64 environment in MSYS2.
You're free to compile from commit https://github.com/libvips/build-win64-mxe/commit/208bd40f10f004954e2fad7f152de2044c5ace10. Another option, of course, is that node-canvas' pre-built binaries switch to static linking.
The information that node-canvas requires a 10 year old GTK 2 is simply wrong or not valid anymore.
IIUC, commit https://github.com/lovell/sharp/commit/98349bde28dfc54ff304a2b47afce35488247637 was pushed on 24 Jan 2021 and was based on the https://github.com/node-gfx/node-canvas-prebuilt repository. It seems that it is indeed no longer relevant with v2.7.0, which was released a month later, and bundles the binaries produced by the MINGW64 environment in MSYS2 - see: https://github.com/Automattic/node-canvas/blob/master/prebuild/Windows/preinstall.sh
It's most likely a MSVCRT
/ UCRT
compatibility issue now.
https://www.msys2.org/docs/environments/#msvcrt-vs-ucrt
@kayahr Thanks for the update, great to hear that canvas
is now providing up-to-date binaries for Windows.
I agree this looks like a MSVCRT vs universal runtime conflict so it's definitely worth experimenting with both packages using the modern universal runtime, which might then allow canvas
to do things like support ARM64 on Windows.
I can confirm that it works when using the DLLs from MSYS2 UCRT64 Environment in node-canvas. Windows still has a problem with the duplicate DLL files so the sharp binary folder and the node-canvas binary folder must be consolidated (which happens anyway when bundling the application with esbuild for example). But after doing this node-canvas and sharp work together without problems.
I created a new issue for node-canvas so hopefully the author will switch to the universal runtime in the future: https://github.com/Automattic/node-canvas/issues/2155
@kayahr Thanks, the sharp docs will be updated to reference this - see commit https://github.com/lovell/sharp/commit/ca22af203f77dc484d57e934e3a2c5b057e095f6
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? No, how? (I've selected x64 with everything i believe)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 bynpm view sharp dist-tags.latest
? YesIf you are installing as a
root
orsudo
user, have you tried with thenpm install --unsafe-perm
flag? I dont install as root or sudoIf you are using the
ignore-scripts
feature ofnpm
, have you tried with thenpm install --ignore-scripts=false
flag? Don't know if im doing that, however i ran "Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope LocalMachine" to see if any problems got fixed but noWhat 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
?