1.安装node.js
到官网https://nodejs.org/en/download下载安装即可,有windows的安装包
2.安装yarn(用npm可跳过)
npminstall--globalyarn报错:
npm : 无法加载文件 C:\Program Files\nodejs\npm.ps1,因为在此系统上禁止运行脚本。
有关详细信息,请参阅 https:/go.microsoft.com/fwlink/?LinkID=135170 中的 about_Execution_Policies。
所在位置 行:1 字符:
1+ npm install --global yarn+ ~~~ ‘
- CategoryInfo : SecurityError: (😃 [],PSSecurityException
- FullyQualifiedErrorId : UnauthorizedAccess
经查,原因:现用执行策略是 Restricted(默认设置)
解决办法:
1.win+X键,使用管理员身份运行power shell
2.输入命令:set-executionpolicy remotesigned
PS C:\Users\chenc>npminstall--globalyarnadded1packagein6snpmnoticenpmnotice New minor version ofnpmavailable!11.12.1 ->11.14.1npmnotice Changelog: https://github.com/npm/cli/releases/tag/v11.14.1npmnotice To update run:npminstall-gnpm@11.14.1npmnoticePS C:\Users\chenc>yarn--version1.22.223.安装vue cli
yarn global add @vue/cli 或 npm i @vue/cli -g
我用的是npm i @vue/cli -g
安装后以下目录有vue
PS C:\Users\chenc>npmconfig get prefix C:\Users\chenc\AppData\Roaming\npm4.查看vue版本
PS C:\Users\chenc>vue--version@vue/cli5.0.95.创建项目架子:
vue create $project-name (项目名-不能用中文)
启动项目:
yarn serve或npm run serve (找package.json)
以下是创建项目架子的自我操作:
✨ Creating projectinD:\cc_study\vue\vue\ccdemo01. 🗃 Initializinggitrepository... ⚙️ Installing CLI plugins. This might take a while... added829packagesin42s109packages are lookingforfunding run`npmfund`fordetails 🚀 Invoking generators... 📦 Installing additional dependencies... added86packagesin8s121packages are lookingforfunding run`npmfund`fordetails ⚓ Running completion hooks... 📄 Generating README.md... 🎉 Successfully created project ccdemo01. 👉 Get started with the following commands: $cdccdemo01 $npmrun serve以下是运行项目的自我操作:
PS D:\cc_study\vue\vue\ccdemo01>npmrun serve>ccdemo01@0.1.0 serve>vue-cli-service serve INFO Starting development server... DONE Compiled successfullyin9015ms23:03:49 App running at: - Local: http://localhost:8080/ - Network: http://192.168.1.34:8080/ Note that the development build is not optimized. To create a production build, runnpmrun build.