我正在做一个项目,我试着把它放在vercel中,但是有这样的错误:
[12:34:28.806] Cloning github.com/Samuel-Schlemper-Schlemuel/Save_URL (Branch: main, Commit: f60a16f)
[12:34:29.040] Cloning completed: 234.251ms
[12:34:29.433] Looking up build cache...
[12:34:30.291] Build cache downloaded [4.39 MB]: 497.872ms
[12:34:30.323] Running "vercel build"
[12:34:30.805] Vercel CLI 28.4.7
[12:34:30.933] WARN! Due to `builds` existing in your configuration file, the Build and Development Settings defined in your Project Settings will not apply. Learn More: https://vercel.link/unused-build-settings
[12:34:31.424] Installing dependencies...
[12:34:31.775] yarn install v1.22.17
[12:34:31.795] info No lockfile found.
[12:34:31.799] [1/5] Validating package.json...
[12:34:31.802] [2/5] Resolving packages...
[12:34:32.145] warning dns > winston > request@2.16.6: request has been deprecated, see https://github.com/request/request/issues/3142
[12:34:32.193] warning dns > winston > request > hawk@0.10.2: This module moved to @hapi/hawk. Please make sure to switch over as this distribution is no longer supported and may contain bugs and critical security issues.
[12:34:32.199] warning dns > winston > request > node-uuid@1.4.8: Use uuid module instead
[12:34:32.296] warning dns > winston > request > hawk > hoek@0.7.6: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
[12:34:32.299] warning dns > winston > request > aws-sign@0.2.1: Incorrectly published ES6 version into the 0.x branch
[12:34:32.301] warning dns > winston > request > hawk > boom@0.3.8: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
[12:34:32.302] warning dns > winston > request > hawk > boom > hoek@0.7.6: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
[12:34:32.321] warning dns > winston > request > hawk > cryptiles@0.1.3: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
[12:34:32.322] warning dns > winston > request > hawk > cryptiles > boom@0.3.8: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
[12:34:32.334] warning dns > winston > request > hawk > sntp@0.1.4: This module moved to @hapi/sntp. Please make sure to switch over as this distribution is no longer supported and may contain bugs and critical security issues.
[12:34:32.335] warning dns > winston > request > hawk > sntp > hoek@0.7.6: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
[12:34:32.662] warning dns > tomahawk > socket.io > socket.io-parser > json3@3.2.6: Please use the native JSON object instead of JSON 3
[12:34:32.662] warning dns > tomahawk > socket.io > socket.io-adapter > socket.io-parser > json3@3.2.6: Please use the native JSON object instead of JSON 3
[12:34:32.790] error An unexpected error occurred: "http://github.com/component/emitter/archive/1.0.1.tar.gz: ENOENT: no such file or directory, open '/vercel/.cache/yarn/v6/.tmp/c093b6de586a0ae2ebbab27ba3b833a5/.yarn-tarball.tgz'".
[12:34:32.791] info If you think this is a bug, please open a bug report with the information provided in "/vercel/path0/yarn-error.log".
[12:34:32.791] info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
[12:34:35.327] Build Completed in /vercel/output [4s]
[12:34:38.156] Generated build outputs:
[12:34:38.157] - Static files: 0
[12:34:38.157] - Serverless Functions: 1
[12:34:38.157] - Edge Functions: 0
[12:34:38.157] Serverless regions: Washington, D.C., USA
[12:34:38.157] Deployed outputs in 2s
[12:34:38.994] Build completed. Populating build cache...
[12:34:41.297] Uploading build cache [4.39 MB]...
[12:34:42.143] Build cache uploaded: 845.755ms
[12:34:42.168] Done with "."我很想把这个项目放到vercel中,我想这个错误是因为vercel不导入DNS库,而且我是想用DNS来创建vercel函数,这分别是我的package.json和我的vercel.json:
{
"name": "url_saver",
"version": "1.0.0",
"description": "A FCC project",
"main": "index.js",
"engines": {
"node": "14.x"
},
"scripts": {
"start": "node index.js"
},
"dependencies": {
"dns": "^0.2.2",
"dotenv": "^16.0.3",
"express": "^4.18.1",
"mongoose": "^6.6.2",
"url": "^0.11.0"
},
"keywords": [
"node",
"express",
"freecodecamp",
"mongoose"
],
"license": "MIT",
"author": "Samuel Schlemper"
}{
"version": 2,
"builds": [
{
"src": "./index.js",
"use": "@vercel/node"
}
],
"routes": [
{
"src": "/(.*)",
"dest": "/"
}
]
}项目链接:https://github.com/Samuel-Schlemper-Schlemuel/Save_URL
我更喜欢使用vercel UI或者在可能的情况下更改我的一些文件,但是如果有必要的话,我也可以使用命令行。
发布于 2022-10-12 02:09:25
我发现有一个名为DNS查找的库,它只有dns.lookup()函数,我使用它来修复我的项目并使它工作,尽管我还没有弄清楚如何导入DNS库本身。
https://stackoverflow.com/questions/74015049
复制相似问题