vue项目下常用的npm命令
文章目录
- 1、npm run serve
- 2、npm install
- 3、npm run duild
- 其他
- 参考文档
1、npm run serve
- 一般为npm项目的启动命令
2、npm install
-
用于构建vue项目启动需要的环境
-
构建项目需要的依赖
-
运行前,文件总大小为1.8MB
-
运行后,大小为166MB,node_modules占了164MB
3、npm run duild
-
用于构建服务器启动,启动方式看参考文档(不是三言两语能解释的)
-
运行前
-
运行后,这个dist文件夹大致为10.9MB(作者的数据)
- 打包之后的使用
一开始运行npm run build 命令时,有这么一段提示:
这句话的意思就是:构建文件务必放在一个HTTP服务器。直接打开index.html文件将不工作。
解决方式:创建下面这个文件,重新运行npm run build
vue.config.js
module.exports={
publicPath:"./"
}
其他
- npm不仅仅可以在vue中使用,还有不少的地方使用到这个工具,所以有不少的命令和vue并没有关系,npm只是vue项目中的一项工具而已。
参考文档
- npm run build 打包命令
- vue-cli使用 npm run build打包后流程
- vue3项目 目录结构没有config文件夹
- express 搭建本地简易服务器
米饭加量: 系统环境变量是Java8,用户环境变量是Java17,所以出错了,有一个Bean总是注入不进来。都换成Java8就好了
米饭加量: 我总是报错缺少Bean,是为什么[code=java] 07:24:03,498 [localhost-startStop-1] WARN com.mchange.v2.resourcepool.BasicResourcePool - Bad pool size config, start 3 < min 5. Using 5 as start. 07:24:04,214 [localhost-startStop-1] WARN org.springframework.web.context.support.AnnotationConfigWebApplicationContext - Exception encountered during context initialization - cancelling refresh attempt org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'activitiClientService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: protected com.activiti.service.activiti.ServerConfigService com.activiti.service.activiti.ActivitiClientService.serverConfigService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'serverConfigService': Injection of autowired dependencies failed; nested exception is org.springframework.bean [/code]
北风toto: 挺尴尬的
北风toto: 因为不好修复,作者也没去修复
pine..: 把电脑的防火墙关闭了试试