Mryqu's Notes


  • 首页

  • 搜索
close

Vue.js开发环境设置

时间: 2020-04-20   |   分类: FrontEnd     |   阅读: 209 字 ~1分钟

设置Node.js和NPM

升级Node(n不支持Windows操作系统):

node -v              #查看Node版本
npm cache clean -f   #清除Node的缓存
npm install -g n     #安装n工具,该工具是专门管理Node版本的工具
n stable             #安装最新稳定的Node版本

升级NPM:

npm -v                      #查看NPM版本 
npm install npm@latest -g   #安装最新稳定的NPM版本

我在两台机器上安装了Node 12.16.2 TLS,其中一台机器上npm死活有问题,从Node 10.16版本开始总是报错verbose stack TypeError: Cannot read property 'resolve' of undefined。
最后在那台机器上重新安装了Node 10.15.3,才避免了问题。

安装Chrome插件Vue.js devtools

在vue-devtools github项目页面里找到Chrome插件网址,进行安装。 install Vue.js Dev Tools 安装后,在Chrome开发者工具中可以看到Vue Tab并使用。
use Vue Dev Tools

安装Vue CLI

npm install -g @vue/cli

使用Vue CLI创建Vue项目

C:\ws>vue create hello-vue


Vue CLI v4.3.1
? Please pick a preset: default (babel, eslint)


Vue CLI v4.3.1
✨  Creating project in C:\ws\hello-vue.
🗃  Initializing git repository...
⚙️  Installing CLI plugins. This might take a while...


> yorkie@2.0.0 install C:\ws\hello-vue\node_modules\yorkie
> node bin/install.js

setting up Git hooks
done


> core-js@3.6.5 postinstall C:\ws\hello-vue\node_modules\core-js
> node -e "try{require('./postinstall')}catch(e){}"


> ejs@2.7.4 postinstall C:\ws\hello-vue\node_modules\ejs
> node ./postinstall.js

added 1203 packages from 845 contributors in 265.235s
🚀  Invoking generators...
📦  Installing additional dependencies...

added 54 packages from 39 contributors in 27.284s
⚓  Running completion hooks...

📄  Generating README.md...

🎉  Successfully created project hello-vue.
👉  Get started with the following commands:

 $ cd hello-vue
 $ npm run serve


C:\ws>

此外也可以使用vue ui以网页图形界面的方式创建Vue项目。
要是觉得npm下载挺慢的,可以提前改用国内taobao的npm源:npm config set registry https://registry.npm.taobao.org。

使用IntelliJ创建Vue项目

首先需要安装Vue.js插件:
install Vue.js plugin in IntelliJ

然后创建Vue.js项目:
create Vue prj in IntelliJ - 1

create Vue prj in IntelliJ - 2

create Vue prj in IntelliJ - 3

参考

  • n – Interactively Manage Your Node.js Versions
  • Cannot read property ‘resolve’ of undefined #1941
  • Try the latest stable version of npm
  • Intellij IDEA help - Vue.js
  • Intellij IDEA plugin - Vue.js

标题:Vue.js开发环境设置
作者:mryqu
声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 3.0 CN 许可协议。转载请注明出处!

#vue#
Gradle构建ReactJS前端实践
React.js开发环境设置
  • 文章目录
  • 站点概览

Programmer & Architect

662 日志
27 分类
1472 标签
GitHub Twitter FB Page
    • 设置Node.js和NPM
    • 安装Chrome插件Vue.js devtools
    • 安装Vue CLI
    • 使用Vue CLI创建Vue项目
    • 使用IntelliJ创建Vue项目
    • 参考
© 2009 - 2023 Mryqu's Notes
Powered by - Hugo v0.120.4
Theme by - NexT
0%