node14.15.1绿色版配置,以及项目的初始化和启动

1、在官网下载

https://nodejs.org/zh-cn/download/

2、下载界面

3、解压后的路径(根据自己的路径进行配置)

添加根路经到paht中

注意:添加了node_global配置,在使用的时候vue init webpack xxx会报错找不到vue命令,添加此配置,vue的命令可找到(在5.1或者5.2之后配置)

4、配置后打开cmd查看node和npm的版本

node -v #分别查看node
npm -v #npm的版本号

5、修改配置

5.1更换安装全局模块node_global和缓存node_cache的路径

npm config set prefix "E:\software\node\node-v14.15.1-win-x64\node_global"
npm config set cache "E:\software\node\node-v14.15.1-win-x64\node_cache"
npm config set registry https://registry.npm.taobao.org/

5.2或者使用以下方法C:Users\Administrator\.npmrc

prefix="E:\software\node\node-v14.15.1-win-x64\node_global"
cache="E:\software\node\node-v14.15.1-win-x64\node_cache"
registry="http://registry.npm.taobao.org/"

6、安装依赖(脚手架,打包插件webpack,cnpm代替npm下载等)

#安装vue.js
npm install vue -g
#安装vue-route
npm install vue-router -g
#安装vue-cli脚手架
npm install vue-cli -g
#安装webpack
npm install webpack -g
#使用yarn替换npm下载
npm install -g yarn
#安装cnpm
npm install -g cnpm

7、初始化项目

7.1、创建项目第一个项目

vue init webpack  "项目名称"
1、Project name //项目名称
2、Project description A Vue.js project //项目的描述,默认的
3、Author *@qq.com //默认,回车即可
4、Vue build (Use arrow keys) //默认,回车即可
5、Vue build standalone //默认,回车即可
6、Install vue-router? No //是否安装路由
7、Use ESLint to lint your code? Yes //是否用ESLint来规范我们的代码
8、Set up unit tests No //是否使用自动化的测试工具
9、Setup e2e tests with Nightwatch? No //使用nightatch设置E2E测试
10、Should we run npm install for you after the project has been created? (recommended) npm //选择npm安装

7.2、安装依赖(进入项目的根路径,然后执行安装命令)

cnpm install

7.3、运行项目

npm run dev

猜你喜欢

转载自blog.csdn.net/www1056481167/article/details/112449138