Vue2.0 | 将项目打包成exe文件

前期准备:🙂

  1. 确保本地网络可以访问 Github。
  2. 确保本地正确安装 NodeJs,可使用 node -v 查看版本。
  3. 确保待打包项目可正常运行。
  4. 本篇 NodeJs 版本 v14.15.1。

本篇介绍使用 pkg 插件将 Vue 项目打包成 exe 文件;前期准备完成之后,cmd 进入项目根目录,执行以下步骤:

1. 安装 pkg

全局安装 pkg ,执行命令 npm i -g pkg

> npm i -g pkg
C:\setup\nodejs\pkg -> C:\setup\nodejs\node_modules\pkg\lib-es5\bin.js
+ pkg@5.8.1
added 127 packages from 94 contributors in 18.848s

2. 下载项目依赖

执行命令npm install 下载项目依赖。

> npm install
npm WARN webstatic@1.0.0 No description
npm WARN webstatic@1.0.0 No repository field.

up to date in 10.433s

14 packages are looking for funding
  run `npm fund` for details

3. 初始化并安装 express 包

执行命令 npm init & npm i -D express ,执行过程中的步骤,直接 Enter 默认下一步。

> npm init & npm i -D express
This utility will walk you through creating a package.json file.
It only covers the most common items, and tries to guess sensible defaults.

See `npm help init` for definitive documentation on these fields
and exactly what they do.

Use `npm install <pkg>` afterwards to install a package and
save it as a dependency in the package.json file.

Press ^C at any time to quit.
package name: (webstatic)
version: (1.0.0)
description:
git repository:
keywords:
author:
license: (ISC)
About to write to C:\workspace\project
  • 6
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值