sharp: Windows - Specified module not found: Sharp

Additional information here: https://github.com/lovell/sharp/issues/1387

I have also tried making a brand new project with sharp as the only package. index.js

const testMod = require("sharp");

console.log("Done!");

package.json

{
  "dependencies": {
    "sharp": "^0.20.8"
  }
}

Running gives me this error:

internal/modules/cjs/loader.js:718
  return process.dlopen(module, path.toNamespacedPath(filename));
                 ^

Error: The specified module could not be found.
\\?\E:\Computer-Stuff\Javascript\2018\New folder\node_modules\sharp\build\Release\sharp.node
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:718:18)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.<anonymous> (E:\Computer-Stuff\Javascript\2018\New folder\node_modules\sharp\lib\constructor.js:10:15)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
PS E:\Computer-Stuff\Javascript\2018\New folder>

What I have done: I have installed node-gyp, I have installed windows-build-tools 6 times and redid install for vs community twice and installed python 2.7 twice. But nothing works. I have been stuck on this problem for at least a week and I’m am really frustrated.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 16 (5 by maintainers)

Most upvoted comments

Great, thanks for confirming.

It looks like there were (temporary) networking problems during a previous installation attempt that corrupted the cache. This situation came up a few days ago in #1382 so I’ll see what can be done to improve error reporting in sharp.

The salient error this time is:

info sharp Using cached C:\Users\Super\AppData\Roaming\npm-cache\_libvips\libvips-8.6.1-win32-x64.tar.gz
(node:7996) UnhandledPromiseRejectionWarning: ZlibError: zlib: unexpected end of file

Remove the C:\Users\Super\AppData\Roaming\npm-cache\_libvips directory and try again.