vue3+typescript+electron+NodeSerialport开发环境搭建

本文档详细介绍了如何在最新技术栈下,包括vue3、typescript和electron,设置NodeSerialport的开发环境。过程中涵盖了安装node.js、vue-cli、创建vue项目、集成electron、配置npm源、解决下载问题,以及安装和配置node-gyp、python和C++环境等步骤。

由于现在网上的教程文档使用的版本还有发布时间过于久远,前端技术更新较快,所以有了这一篇开发环境搭建

目录

安装node.js

安装vue-cli 

创建一个vue项目 

 vue项目集成electron

安装NodeSerialport的准备工作

安装node-gyp

安装python

安装C++环境

安装NodeSerialport


安装node.js

node官网网址

点击进入node官网网址,下载16.13.0 LTS长期支持版本

 默认一路安装

使用Win+R键打开运行窗口,输入powershell,敲击回车

 

在powrshell窗口中输入:node -v

node -v

安装vue-cli 

vue-cli官网网址

点击网址进入官网,点击起步

侧边栏目录找到安装

 

往下浏览找到此页面

 

这里我是喜欢用yarn介于刚刚开始学习的同学,我这里使用npm 

在使用npm之前,由于众所周知的原因我们需要切换npm的仓库地址

在powrshell窗口中输入:npm config set registry https://registry.npm.taobao.org

npm config set registry https://registry.npm.taobao.org

接下来按照vue-cli教程全局安装vue-cli

 

创建一个vue项目 

找到一个合适的目录下

在powrshell窗口中输入:vue create vue-electron-serialport

vue create vue-electron-serialport

选择第三个自定义配置 

 

### Vue 3 with TypeScript and Vite Project Setup For setting up a project using Vue 3, TypeScript, and Vite, one can start by ensuring the development environment is ready for these technologies. The `package.json` file plays an essential role in configuring scripts that facilitate various tasks within the project lifecycle[^1]. For instance, including specific script commands like `"dev": "vite"` allows developers to run the application in development mode easily. To initialize such a project, installing Vite as well as its dependencies through npm or yarn is necessary: ```bash npm init vite@latest my-vue-app --template vue-ts cd my-vue-app npm install ``` After installation, running the following command starts the server for development purposes: ```bash npm run dev ``` The configuration of the build process also benefits from customizations made inside the `package.json`. Adding particular scripts ensures smooth integration between different tools used during development, such as Electron rebuilds which might be required when working on desktop applications involving native modules. In addition to basic setup instructions provided above, exploring official documentation resources offers deeper insights into advanced configurations and best practices associated with building modern web apps leveraging Vue 3 alongside TypeScript powered by Vite's performance optimizations. #### Example Directory Structure A typical directory structure may look similar to this after completing initial steps mentioned earlier: ``` my-vue-app/ ├── node_modules/ ├── public/ │ └── favicon.ico ├── src/ │ ├── assets/ │ │ └── logo.png │ ├── components/ │ │ └── HelloWorld.vue │ ├── App.vue │ └── main.ts ├── .gitignore ├── index.html ├── package.json └── tsconfig.json ``` This layout supports organizing source files logically while adhering to conventions recommended both by Vue CLI templates and community standards around structuring projects built upon these frameworks.
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值