我无法安装gatsby-plugin-sharp

时间:2020-05-23 09:17:37

标签: npm gatsby

`import json
import http.client

text = '"هذا مثال بسيط"'
text = text.replace('"', '')
conn = http.client.HTTPSConnection("farasa-api.qcri.org")
payload = "{\"text\":\"%s\"}"% text
payload = payload.encode('utf-8')

headers = { 'content-type': "application/json", 'cache-control': "no-cache", }

conn.request("POST", "/msa/webapi/lemma", payload, headers)

res = conn.getresponse()

data = res.read().decode('utf-8')
data_dict = json.loads(data)`

尝试在我的Windows7 32位版上安装gatsby-plugin-sharp,但遇到此错误

struct ContentView: View {
    var body: some View {
        UITableView.appearance().separatorStyle = .none
        return NavigationView { 
            Form { 
                Section { 
                    RowView(iconName:"rectangle.stack", text:"Some text")
                    RowView(iconName:"paintbrush", text:"Some other text", showDivider: false)
                }
            }
        }
    }
}

struct RowView: View {
    var iconName: String
    var text: String
    var showDivider = true
    var body: some View {
        HStack(alignment: .firstTextBaseline) {
            Image(systemName: iconName)
            VStack(alignment: .leading) { 
            Text(text)
                if showDivider { 
                    Divider()
                } else {
                    Spacer()
                }
            }
        }
    }
}

2 个答案:

答案 0 :(得分:1)

尝试:

npm install --global windows-build-tools

然后,再次安装gatsby-plugin-sharp

   npm i gatsby-plugin-sharp

资源:

答案 1 :(得分:0)

在我的机器上,建议的解决方案不起作用。最近几天,我尝试了许多不同的方法。唯一安装了该插件的插件是以下(Windows):

  1. 检查全局忽略脚本是否未设置为false:

    npm config set ignore-scripts true
    
  2. node_modules

    中删除旧的 sharp 文件夹
  3. 将其重新安装为:

    npm install sharp --unsafe-perm
    
  4. 如果上述方法无效,请尝试

    npm rebuild --verbose sharp 
    

祝您编程愉快!您可以参考this link