简体   繁体   English

vue-cli的安装:它是如何工作的?

[英]Installation of vue-cli : how does it work?

I'm very new to Node Package Manager and also Vue, and I'm trying to understand what exactly is going on with using the Vue CLI.我对 Node Package Manager 和 Vue 非常陌生,我试图了解使用 Vue CLI 到底发生了什么。

The vue.js website has this as instructions for running the official Vue CLI: vue.js 网站上有运行官方 Vue CLI 的说明:

在此处输入图像描述

I have a few questions about this:我对此有几个问题:

  1. Does npm install --global vue-cli need to be executed only once on a machine, or once on a directory, or once per new project you're starting? npm install --global vue-cli是否只需要在机器上执行一次,或者在目录上执行一次,或者每个您正在启动的新项目执行一次? In other words, once it's on your computer, is that the last time you need to run that command, or do you need to execute this command every single new project you start?换句话说,一旦它在您的计算机上,是您最后一次需要运行该命令,还是您需要在您开始的每个新项目中执行该命令?
  2. Once a new project is initiated, are local copies of the newest version of vue (and vue-router, if selected) installed?启动新项目后,是否安装了最新版本的 vue(和 vue-router,如果选择)的本地副本?
  3. If I finish this project and want to deploy it, how do I then port this over to a production server?如果我完成了这个项目并想要部署它,我该如何将它移植到生产服务器上?
  1. Once in a machine, except for the rare cases where one is isolating one's npm install (such as by using nodeenv or inside a container);一旦进入机器,除了极少数情况下隔离自己的npm安装(例如通过使用nodeenv或在容器内); that's what the global option is for.这就是global选项的用途。

  2. After running npm install , yes.运行npm install后,是的。

  3. Running npm run build and copying the contents of the resulting dist directory to the production machine (often within a /var/www directory or similar).运行npm run build并将生成的dist目录的内容复制到生产机器(通常在/var/www目录或类似目录中)。 This can be automated further in many ways.这可以通过多种方式进一步自动化。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM