Vue框架项目实战整理:7、Vue项目环境搭建2——回顾快速版

目录

1、查看 vue命令是否可用

设置使用指定版本的node

再次查看 vue命令是否可用

2、创建项目模板

3、执行 npm install 命令

4、npm run start 启动项目


1、查看 vue命令是否可用

$ vue
bash: vue: command not found

记得之前 vue-cli脚手架构建工具,都是安装好的。

Vue框架项目实战整理:2、Vue项目环境搭建(有图有真相)

然后想起之前安装了nvm,对node版本的管理。

 

设置使用指定版本的node

$ nvm use v10.16.0
Now using node v10.16.0 (npm v6.9.0)

 

再次查看 vue命令是否可用

这时候可再次查看 vue命令是否可用

$ vue
Usage: vue <command> [options]

Options:
  -V, --version  output the version number
  -h, --help     output usage information

Commands:
  init           generate a new project from a template
  list           list available official templates
  build          prototype a new project
  create         (for v3 warning only)

 

2、创建项目模板

$ vue init webpack-simple mobileProject
? Project name (mobileProject) mobileProject
>> Sorry, name can no longer contain capital letters.

Sorry, name can no longer contain capital letters.

抱歉,名称不能再包含大写字母

$ vue init webpack-simple mobileproject
? Project name mobileproject
? Project description A Vue.js project
? Author 
? License MIT
? Use sass? No
   vue-cli · Generated "mobileproject".
   To get started:
   
     cd mobileproject
     npm install
     npm run dev

执行命令以后,有关提示都直接 enter 回车就行。

这个回头项目构建成功,都可以在项目目录下的 package.json 文件上进行配置修改。

 

3、执行 npm install 命令

切换到项目目录,执行 npm install 命令,它就会把 package.json文件记录的包给安装下来!

$ cd mobileproject
$ npm install
npm WARN deprecated [email protected]: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
npm WARN deprecated [email protected]: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
。。。
。。。
npm notice created a lockfile as package-lock.json. You should commit this file.
added 847 packages from 584 contributors and audited 847 packages in 38.373s
found 11 vulnerabilities (3 low, 4 moderate, 4 high)
  run `npm audit fix` to fix them, or `npm audit` for details

 

4、npm run start 启动项目

$ npm run dev
。。。
。。。
> cross-env NODE_ENV=development webpack-dev-server --open --hot
Project is running at http://localhost:8081/
webpack output is served from /dist/
404s will fallback to /index.html
{ parser: "babylon" } is deprecated; we now treat it as { parser: "babel" }.

 

 

 

之前写的一些博文:

Vue框架项目实战整理:1、Vue开发工具介绍、快速启动、常见错误

Vue框架项目实战整理:2、Vue项目环境搭建(有图有真相)

Node.js后端开发 - 基础篇 #16 包管理器 NPM

Node.js后端开发 - 基础篇 #17 package.json 文件

Node.js后端开发 - 基础篇 #18 nodemon工具

原创 -bash: express: command not found(我们不一样,困扰我一天的问题!)

原创 JavaEE后台环境搭建:2、Mac系统安装配置nvm

原创 JavaEE后台环境搭建:3、通过nvm安装指定版本的node

 

 

 

 

 

 

 

 

 

 

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章