Home >WeChat Applet >Mini Program Development >Learn to build WeChat applet and official account application development environment on Ubuntu 18.04

Learn to build WeChat applet and official account application development environment on Ubuntu 18.04

coldplay.xixi
coldplay.xixiforward
2020-08-17 16:43:294526browse

Learn to build WeChat applet and official account application development environment on Ubuntu 18.04

[Related learning recommendations: WeChat Mini Program Development Tutorial]

Build a development environment for WeChat mini programs and public account applications on Ubuntu 18.04

Install NVM

If you used apt-get to install Node.js on Ubuntu, you need to remove it manually first:

$ sudo apt-get purge nodejs && sudo apt-get autoremove && sudo apt-get autoclean

Install NVM: After

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.1/install.sh | bash

or

wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.1/install.sh | bash

is installed, add the following code to ~/.bash_profile, ~/.zshrc, ~ /.profile, or ~/.bashrc:

export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm

Test:

在Ubuntu 18.04上 搭建微信小程序和公众号应用开发环境

## Use Taobao mirror

export NVM_NODEJS_ORG_MIRROR=http://npm.taobao.org/mirrors/node
NVM Common Instructions

View all Node.js versions available locally

$ nvm list

View those available on the server Node.js version

$ nvm ls-remote
*

Install `8.` LTS version (long-term maintenance version) **

$ nvm install 8.16.2

Set the default version

$ nvm use  8.16.2
$ nvm alias default  8.16.2

Use Taobao to accelerate NPM

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

Update NPM to the latest

$ npm install -g npm

Detection version

$ npm -v
Install Yarn

First method: Install Stable version 1.19.1

Configure warehouse:

url -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
Installation:

sudo apt-get update && sudo apt-get install --no-install-recommends yarn
Second method: Install

npm install --global yarn
through npm and then set the PATH environment variable in the terminal (that is, add the following code to

~/ .bash_profile, ~/.zshrc, ~/.profile, or ~/.bashrc)

export PATH="$PATH:`yarn global bin`"
Finally run the command Test whether Yarn is successfully installed:

yarn --version

在Ubuntu 18.04上 搭建微信小程序和公众号应用开发环境

Install Linux WeChat web developer tools

Download project and initialization

git clone https://github.com/cytle/wechat_web_devtools.git
cd wechat_web_devtools
# 自动下载最新 `nw.js` , 同时部署目录 `~/.config/wechat_web_devtools/`
./bin/wxdt install

Install Wine

sudo apt-get install wine-binfmt
sudo update-binfmts --import /usr/share/binfmts/wine

Start ide, develop and debug web pages

./bin/wxdt # 启动

在Ubuntu 18.04上 搭建微信小程序和公众号应用开发环境

Basic environment for small programs Build

Install wepy-ci

WePY is a component-based development framework for small programs. The development style is close to Vue.js and closer to the MVVM architecture model. Compared with small programs Native development of programs is more convenient and faster.

yarn global add wepy-cli

Initialize the project

mkdir helloworld
cd helloworld 
helloworld  wepy init standard ./

在Ubuntu 18.04上 搭建微信小程序和公众号应用开发环境

Compile the project and continue to monitor code changes**

wepy build --watch

在Ubuntu 18.04上 搭建微信小程序和公众号应用开发环境

Related learning recommendations:

WeChat public account development tutorial

The above is the detailed content of Learn to build WeChat applet and official account application development environment on Ubuntu 18.04. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:learnku.com. If there is any infringement, please contact admin@php.cn delete