javascript - MAC M1 安装 "sharp"模块出现问题

标签 javascript node.js npm apple-m1 sharp

运行npm run dev ( gatsby develop ) 在 MacBook Pro M1 芯片上退出 Error: Something went wrong installing the "sharp" module运行npm run dev MacBook Pro 英特尔芯片工作正常。
我看过类似的帖子,但没有解决我的问题:

  • When i run "gatsby develop " Something went wrong installing the "sharp" module error is showing
  • Error Installing Gatsby Starter 'Something went wrong installing the "sharp" module'
  • Gatsby Develop : Something went wrong installing the "sharp" module

  • 我已经更新了我的 Node 版本以防任何修复,但我仍然在 node v16.0.0 上遇到错误
    在此 github issue他们建议遵循这些不起作用的步骤。
    rm -r node_modules/sharp
    yarn install --check-files
    

    在此 github issue他们建议安装 NVM并降级 Node 版本。 NVM 在我的 M1 芯片上安装有些困难,所以它对我来说不是一个好的选择。
    我也尝试执行以下步骤,但效果不佳
    rm -rf node_module
    rm package-lock.json
    npm i 
    
    知道我能做些什么来让工作变得简单gatsby develop在 M1 芯片上?

    最佳答案

    遵循 this issue 中的这些步骤解决了我的问题。

  • xcode-select --install
  • brew install gcc
  • brew reinstall vips
  • brew info vips
  • npm i

  • 然后你可以运行 gatsby develop

    关于javascript - MAC M1 安装 "sharp"模块出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67560211/

    相关文章:

    javascript - 有没有办法以 Angular 方式从父 Controller 向子 Controller 发送 promise ?

    javascript - 来自默认浏览器的 Electron "grab"localStorage

    javascript - 使用 FFmpeg 通过管道输出视频片段

    javascript - 我正在编写一个页面,该页面在单击链接时向下滚动。点击后显示为蓝色

    javascript - 定高容器如何分成80%和20%

    node.js - 类型错误 : Cannot call method 'get' of undefined

    javascript - npm init给出错误:找不到模块'process-nextick-args'

    node.js - 如何为多个 npm 存储库创建共享 package.json

    twitter-bootstrap - Laravel 混合 | Bootstrap 弃用警告 : Using/for division is deprecated and will be removed

    javascript - 替换窗口时 window.open() 的 window.opener 问题