如果 vercel hook 运行部署,我会收到此错误。 我的 git 存储库位于 github.com 上,我将存储库与 vercel.com 连接起来。
我重组了我的项目,现在我遇到了这个奇怪的汇总问题。本地一切正常,所以这里是我的项目设置
package.json
{
"name": "...",
"type": "module",
"version": "0.0.1",
"packageManager": "[email protected]",
"engines": {
"node": ">=18.x"
},
"private": true,
"scripts": {
"dev": "astro dev",
"prebuild": "yarn prebuild:images",
"build": "astro build",
"prebuild:images": "node build.images.js",
"astro": "astro",
"lint": "eslint",
"format": "format"
},
"dependencies": {
"@astrojs/image": "^0.17.2",
"@astrojs/preact": "^2.2.1",
"@astrojs/vercel": "^3.7.5",
"@fontsource/plus-jakarta-sans": "^5.0.5",
"astro": "^2.9.7",
"astro-purgecss": "^2.0.0",
"astro-robots-txt": "^0.5.0",
"astro-seo": "^0.7.5",
"astro-sitemap": "^0.6.0",
"astro-webmanifest": "^0.6.0",
"autoprefixer": "^10.4.14",
"jimp": "^0.22.10",
"postcss": "^8.4.27",
"preact": "^10.16.0",
"sass": "^1.64.2",
"vercel": "^31.2.1",
"web-vitals": "^3.4.0",
"webp-converter": "^2.3.3"
},
"devDependencies": {
"@playwright/test": "^1.30.0",
"@typescript-eslint/eslint-plugin": "^5.42.0",
"@typescript-eslint/parser": "^5.42.0",
"@vitest/coverage-c8": "^0.28.3",
"eslint": "^8.26.0",
"eslint-config-prettier": "^8.5.0",
"eslint-config-turbo": "^0.0.4",
"eslint-plugin-astro": "^0.21.0",
"playwright": "^1.30.0",
"typescript": "^4.8.4",
"vitest": "^0.28.3"
}
}
vercel.json
{
"framework": "astro",
"devCommand": "yarn dev",
"buildCommand": "yarn build",
"installCommand": "yarn install",
"ignoreCommand": "exit 1",
"cleanUrls": true,
"regions": ["fra1"]
}
错误输出
10:27:08 AM [build] Building static entrypoints...
Entry module "@astro-renderers" cannot be external.
error Entry module "@astro-renderers" cannot be external.
File:
/vercel/path0/node_modules/rollup/dist/es/shared/node-entry.js:2245:30
Code:
2244 | if (!(base instanceof Error)) {
> 2245 | base = Object.assign(new Error(base.message), base);
| ^
2246 | Object.defineProperty(base, 'name', { value: 'RollupError' });
2247 | }
2248 | throw base;
Stacktrace:
RollupError: Entry module "@astro-renderers" cannot be external.
at error (file:///vercel/path0/node_modules/rollup/dist/es/shared/node-entry.js:2245:30)
at ModuleLoader.loadEntryModule (file:///vercel/path0/node_modules/rollup/dist/es/shared/node-entry.js:24701:20)
at async Promise.all (index 0)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Error: Command "yarn build" exited with 1
在本地工作:/