Troubleshooting
This article outlines about mitigating common configuration issues and upgrades
Initialization
The project requires Node.js version 18 or up and uses npm as the package manager.
npx create-docusaurus@latest website classic --typescript
- npm
- Yarn
- pnpm
npm run start
yarn run start
pnpm run start
Test locally
- npm
- Yarn
- pnpm
npm run build && npm run serve
yarn build&& yarn serve
pnpm run build&& pnpm run serve
Fix Common Issues
Issues can happen especially during upgrades in the core packages
. If you ran into one, follow these steps:
Clear caches
- npm
- Yarn
- pnpm
npm run clear
yarn clear
pnpm run clear
Delete modules
Delete the node_modules
and package-lock.json
, or yarn.lock
- Bash
- PowerShell
rm -rf node_modules yarn.lock package-lock.json
@('node_modules','yarn.lock','package-lock.json') | Remove-Item -Force -Recurse -ErrorAction SilentlyContinue
Reinstall packages
For Yarn
Skip this if you're not using yarn
.
- Bash
- CMD
- PowerShell
ni yarn.lock
echo. > yarn.lock
New-Item yarn.lock -ItemType File
- npm
- Yarn
- pnpm
npm install
yarn install
pnpm install
Using Yarn
important
Installing Yarn globally is NOT recommended.
Instead, we can use Corepack, which enables us to define our preferred package manager and its version in the package.json
file.
corepack enable
yarn set version stable
yarn install
yarn start