[英]Sharp installs via npm on Windows 10 x64, but gatsby develop does not find procedure \sharp.node
[英]Can't install sharp on windows 10 (x64)
我正在嘗試使用 node.js sharp 在 Windows 10 上進行圖像處理,但require sharp-win32-x64.node
失敗。 請求的.node
文件存在。 為什么require
失敗?
(Install Windows 10 and Git)
(open a git bash)
$ mkdir -p try_sharp
$ cd try_sharp
$ npm init -y
$ npm install sharp
$ npm list
try_sharp@1.0.0 C:\Users\____\Desktop\try_sharp
└── sharp@0.30.1
$ ls node_modules/sharp/build/Release/
libglib-2.0-0.dll* libgobject-2.0-0.dll* libvips-42.dll* libvips-cpp.dll* sharp-win32-x64.node*
$ code index.js #// open a text editor
const s = require('sharp');
$ code node_modules/sharp/lib/sharp.js
before
module.exports = require(`../build/Release/sharp-${platformAndArch}.node`);
after
console.log('-------------')
console.log(platformAndArch)
module.exports = require(`../build/Release/sharp-${platformAndArch}.node`);
console.log('OK')
$ node index.js
-------------
win32-x64
C:\Users\____\Desktop\try_sharp\node_modules\sharp\lib\sharp.js:33
throw new Error(help.join('\n'));
Error:
Something went wrong installing the "sharp" module
The specified module could not be found.
\\?\C:\Users\____\Desktop\try_sharp\node_modules\sharp\build\Release\sharp-win32-x64.node
我發現了一個特定於版本的問題線程。 我的問題已經解決了。 謝謝。 https://github.com/lovell/sharp/issues/3086
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.