Vercel deploy error: npm ERR! gyp verb extracted file from tarball node-v18.15.0/include/node/openssl

huangapple go评论86阅读模式
英文:

Vercel deploy error: npm ERR! gyp verb extracted file from tarball node-v18.15.0/include/node/openssl

问题

我尝试将我的GitHub项目部署到Vercel上。
我的项目是用Vue构建的。
顺便说一下,在Vercel构建项目时,出现了大量类似于这样的错误。

npm ERR! gyp verb 从tarball中提取文件 node-v18.15.0/include/node/openssl/archs/VC-WIN64A/asm_avx2/include/openssl/asn1.h
npm ERR! gyp verb 从tarball中提取文件 node-v18.15.0/include/node/openssl/archs/VC-WIN64A/asm_avx2/include/openssl/safestack.h
npm ERR! gyp verb 从tarball中提取文件 node-v18.15.0/include/node/openssl/archs/VC-WIN64A/asm_avx2/include/openssl/lhash.h

这是Vercel错误的屏幕截图。
查看图像描述

这是package.json中的内容。

{
  "name": "aali-vue",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "serve": "vue-cli-service serve",
    "build": "vue-cli-service build",
    "lint": "vue-cli-service lint"
  },
  "dependencies": {
    "@emailjs/browser": "^3.11.0",
    "core-js": "^3.6.5",
    "isotope-layout": "^3.0.6",
    "jarallax": "^1.12.8",
    "node-sass": "^5.0.0",
    "parallax-js": "^3.1.0",
    "swiper": "^5.4.5",
    "vanilla-tilt": "^1.7.2",
    "vue": "^2.6.11",
    "vue-awesome-swiper": "^4.1.1",
    "vue-fragment": "^1.5.2",
    "vue-number-animation": "^1.1.1",
    "vue-router": "^3.2.0",
    "vue-visibility-sensor": "^0.3.0",
    "wowjs": "^1.1.3"
  },
  "devDependencies": {
    "@vue/cli-plugin-babel": "~4.5.0",
    "@vue/cli-plugin-eslint": "~4.5.0",
    "@vue/cli-plugin-router": "~4.5.0",
    "@vue/cli-service": "~4.5.0",
    "babel-eslint": "^10.1.0",
    "eslint": "^6.7.2",
    "eslint-plugin-vue": "^6.2.2",
    "vue-template-compiler": "^2.6.11"
  },
  "eslintConfig": {
    "root": true,
    "env": {
      "node": true
    },
    "extends": [
      "plugin:vue/essential",
      "eslint:recommended"
    ],
    "parserOptions": {
      "parser": "babel-eslint"
    },
    "rules": {}
  },
  "browserslist": [
    "> 1%",
    "last 2 versions",
    "not dead"
  ]
}

它在本地编译和运行正常。
你知道解决方法吗?

谢谢。

开发环境
操作系统:Windows 10专业版(19045.2965)
编辑器:VS Code
GitHub存储库:
使用我的GitHub帐户在Vercel上部署

英文:

I tried to deploy my github project into vercel.
My project built with vue.
Btw, while building project in vercel, it's got tons of errors like this.

npm ERR! gyp verb extracted file from tarball node-v18.15.0/include/node/openssl/archs/VC-WIN64A/asm_avx2/include/openssl/x509v3.h
npm ERR! gyp verb extracted file from tarball node-v18.15.0/include/node/openssl/archs/VC-WIN64A/asm_avx2/include/openssl/asn1.h
npm ERR! gyp verb extracted file from tarball node-v18.15.0/include/node/openssl/archs/VC-WIN64A/asm_avx2/include/openssl/safestack.h
npm ERR! gyp verb extracted file from tarball node-v18.15.0/include/node/openssl/archs/VC-WIN64A/asm_avx2/include/openssl/lhash.h

Here is screenshot of error of vercel.
enter image description here

Here is content in package.json

{
  "name": "aali-vue",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "serve": "vue-cli-service serve",
    "build": "vue-cli-service build",
    "lint": "vue-cli-service lint"
  },
  "dependencies": {
    "@emailjs/browser": "^3.11.0",
    "core-js": "^3.6.5",
    "isotope-layout": "^3.0.6",
    "jarallax": "^1.12.8",
    "node-sass": "^5.0.0",
    "parallax-js": "^3.1.0",
    "swiper": "^5.4.5",
    "vanilla-tilt": "^1.7.2",
    "vue": "^2.6.11",
    "vue-awesome-swiper": "^4.1.1",
    "vue-fragment": "^1.5.2",
    "vue-number-animation": "^1.1.1",
    "vue-router": "^3.2.0",
    "vue-visibility-sensor": "^0.3.0",
    "wowjs": "^1.1.3"
  },
  "devDependencies": {
    "@vue/cli-plugin-babel": "~4.5.0",
    "@vue/cli-plugin-eslint": "~4.5.0",
    "@vue/cli-plugin-router": "~4.5.0",
    "@vue/cli-service": "~4.5.0",
    "babel-eslint": "^10.1.0",
    "eslint": "^6.7.2",
    "eslint-plugin-vue": "^6.2.2",
    "vue-template-compiler": "^2.6.11"
  },
  "eslintConfig": {
    "root": true,
    "env": {
      "node": true
    },
    "extends": [
      "plugin:vue/essential",
      "eslint:recommended"
    ],
    "parserOptions": {
      "parser": "babel-eslint"
    },
    "rules": {}
  },
  "browserslist": [
    "> 1%",
    "last 2 versions",
    "not dead"
  ]
}

It's compiled and run well locally.
Do you know solution?

Thanks

Development Environment
OS: windows 10 pro (19045.2965)
Editor: VS code
GitHub repository:
Vercel deploy with my github account

Expecting result:
Build and deploy successfully without error

答案1

得分: 1

我使用yarn install解决了这个问题,而不是npm。
Yarn更适合解决依赖性问题,而不是npm。

其步骤如下。

当您在vercel中使用您的帐户登录时,您可以转到设置/常规/构建和开发设置。

设置/常规/构建和开发设置
您可以看到4个输入字段被设置为禁用。
请激活第三个名为“安装命令”的输入,并输入“yarn install”。
然后点击保存按钮。

然后尝试在部署页面重新部署。
通常,它将解决正常的依赖性问题。

在我的情况下,仍然发生了与gyp相关的构建错误。
我猜这可能与node和node-sass版本有关。

我们也可以在vercel中更改node版本。
转到设置/常规/Node.js版本。
您可以看到您的网站的node版本。
Node版本设置

在我的情况下,node版本是18,而package.json中的node-sass版本是5.0.0。
所以,它们不匹配。
我将node更改为16.x,node-sass更新为6.0.0
然后再次部署。

耶!它奏效了。
成功部署

英文:

I resolved this issue using yarn install instead of npm.
Yarn is better to solve dependency issues than npm.

Its step is like following.

When you login with your account in vercel, you can go to Setting/General/Build & Development Settings.

Setting/General/Build & Development Settings
You can see 4 input fields that was set disabled there.
Please active override the 3rd one called Install Command and input yarn install.
And click save button.

And try to redeploy in the deployments page.
Normally, it will be solved normal dependency issues.

In my case, still happened the build error related gyp.
I guess it will be related to node and node-sass version.

We can also change the node version in the vercel.
Go to Setting/General/Node.js version.
You can see node version of your website.
Node version setting

In my case, node version was 18 and node-sass version in the package.json was 5.0.0.
So, they didn't match each other.
I changed the node as 16.x and node-sass updated as 6.0.0
And deployed again.

Ya!. it works.
Deployment successfully

huangapple
  • 本文由 发表于 2023年6月6日 00:43:53
  • 转载请务必保留本文链接:https://go.coder-hub.com/76408454.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定