1.安装nvm,管理 Node.js 版本
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
2.使用 nvm 安装 Node.js和npm
nvm install node
查看安装的版本
node -v
npm -v
3.安装vue,创建项目
npm install -g @vue/cli
vue create my-project
4.进入项目中
cd my-project
5.安装tailwind CSS,用来布局
npm install -D tailwindcss
这里安装完提示我版本node的版本不合适,于是又安装了20版本的node,并选择使用这个版本
nvm install 20
nvm use 20
6.初始化tailwind css
npx tailwindcss init
到了这里,就开始下面的报错:
npm error could not determine executable to run
npm error A complete log of this run can be found in: /Users/mac-ios1/.npm/_logs/
反复尝试无果,最终在网上找到了问题的原因:是因为上面安装的版本跟官网版本不一致导致的。
AAdde.jpg
于是,选择3.4的版本安装:
npm install -D tailwindcss@3.4.17
然后再初始化:
npx tailwindcss init
终于成功了!出现了创建成功的提示:
Created Tailwind CSS config file: tailwind.config.js