Closed zhanshenxiaomao closed 2 months ago
Configure your build commands and dist directory properly in vercel (https://vercel.com/docs/deployments/configure-a-build). It should've auto-detected them if you've selected vitepress preset.
I still can't figure out how to do it. can you give me a chestnut @brc-dd
Open vercel dashboard. Click to your project. Click on settings. There you'll see something like this:
Adjust these commands to what you have locally. (For example if you locally have "docs:build": "vitepress build docs"
in your package.json, you'll need to set build command as vitepress build docs
and output directory to docs/.vitepress/dist
I think this screenshot might be useful @brc-dd
Did you forgot to run npm install
?
What
I am using
npm add -D vitepress
At which directory? You had probably run that in different location.
I'm really sorry. I seem to know the reason. I shouldn't be doing npm add -D vitepress in a certain folder
[15:18:38] Running build in Washington, D.C., USA (East) – iad1
[15:18:38] Retrieving list of deployment files...
[15:18:38] Skipping build cache, deployment was triggered without cache.
[15:18:39] Downloading 36 deployment files...
[15:18:39] Running "vercel build"
[15:18:39] Vercel CLI 33.5.3
[15:18:40] Installing dependencies...
[15:18:40] yarn install v1.22.17
[15:18:40] warning package.json: No license field
[15:18:40] info No lockfile found.
[15:18:40] warning No license field
[15:18:40] [1/4] Resolving packages...
[15:18:40] [2/4] Fetching packages...
[15:18:40] [3/4] Linking dependencies...
[15:18:40] [4/4] Building fresh packages...
[15:18:40] success Saved lockfile.
[15:18:40] Done in 0.04s.
[15:18:40] sh: vitepress: command not found
[15:18:40] Error: Command "vitepress build docs" exited with 127
[15:18:41]
Can you confirm that you have vitepress listed as dependency in your Test/package.json ?
There is only so much content in the package.json file
{
"scripts": {
"docs:dev": "vitepress dev",
"docs:build": "vitepress build",
"docs:preview": "vitepress preview"
}
}
That means you didn't run npm add -D vitepress
in your Test directory.
I think it’s still too late😭😭😭
It's probably not too late now
You don't seem to have any page in your site. Can you show your directory structure, and build command and output directory settings?
[16:10:24] Running build in Washington, D.C., USA (East) – iad1
[16:10:24] Retrieving list of deployment files...
[16:10:24] Skipping build cache, deployment was triggered without cache.
[16:10:24] Downloading 35 deployment files...
[16:10:25] Running "vercel build"
[16:10:26] Vercel CLI 33.5.3
[16:10:26] Installing dependencies...
[16:10:29]
[16:10:29] added 79 packages in 2s
[16:10:29]
[16:10:29] 10 packages are looking for funding
[16:10:29] run `npm fund` for details
[16:10:30]
[16:10:30] [32m[1mvitepress[22m v1.0.0-rc.44[39m
[16:10:30]
[16:10:30] - building client + server bundles...
[16:10:34] [32m✓[0m building client + server bundles...
[16:10:34] - rendering pages...
[16:10:34] [32m✓[0m rendering pages...
[16:10:34] build complete in 4.53s.
[16:10:34] Build Completed in /vercel/output [8s]
[16:10:34] Deploying outputs...
[16:10:35]
[16:10:36] Deployment completed
[16:10:38] Uploading build cache [11.16 MB]...
[16:10:39] Build cache uploaded: 950.902ms
I think you have wrong config on vercel. Try logging into vercel.com and checking from dashboard there. It should be the same as what I shared in screenshot earlier.
Make them what I shared. You'll need to override because you are not using docs/ directory.
Build command - vitepress build
\
Output directory - .vitepress/dist
I didn't expect it to be because of this in the end. But solved. Thank you