簡體   English   中英

無法在 windows 10 (x64) 上安裝 Sharp

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM