参考官网说明,执行下面的命令就可以完成安装:
# layouts.download.codeBox.installsFnm
curl -fsSL https://fnm.vercel.app/install | bash
# layouts.download.codeBox.activateFNM
source ~/.bashrc
# layouts.download.codeBox.downloadAndInstallNodejs
fnm use --install-if-missing 20
# layouts.download.codeBox.verifiesRightNodejsVersion
node -v # layouts.download.codeBox.shouldPrint
# layouts.download.codeBox.verifiesRightNpmVersion
npm -v # layouts.download.codeBox.shouldPrint
- 进入前端项目:
cd frontend
- 安装依赖库
npm install
- 开发环境启动
Compile and Hot-Reload for Development
npm run dev
- 生产环境打包
Type-Check, Compile and Minify for Production
npm run build