Home  >  Article  >  WeChat Applet  >  Introduction to Linux development environment settings for WeChat mini programs

Introduction to Linux development environment settings for WeChat mini programs

高洛峰
高洛峰Original
2017-03-11 16:01:372069browse

This article mainly introduces the relevant information on the detailed explanation of the WeChat Mini Program Linux development environment settings. Friends in need can refer to

WeChat Mini Program Linux Development Environment

WeChat applet development tool is implemented using nw.js, which is inherently cross-platform. I don’t understand why WeChat only has Windows and Mac versions. Today I messed around a bit and can develop WeChat applets under Linux. Take ubuntu as an example:

First, you need to install the nwjs sdk environment. Because you need devtool support, you must install the sdk version.

Download the nwjs sdk compressed package and unzip it to your favorite location, and set the environment variables. The nw executable file is added to the path variable.

The next step is to extract the package.nw file of the WeChat applet development tool. This is the project package file of nwjs. Find a window machine to install the small program development tool, find the package.nw folder in the installation directory, and copy the folder to the Linux system. Logically speaking, you can run it by entering this folder nw., but you will find that an error is reported, because Tencent developers do not distinguish between upper and lower case in the project file references, so it can run on Windows, but not on Linux. Knowing the reason, we will correct the citation error. Execute in the package.nw directory:


sed -i 's/\.\/Create\/create\.js/\.\/create\/create\.js/ig' app/dist/components/ContainController.js
sed -i 's/\.\/main\.js/\.\/Main\.js/ig' app/dist/components/ContainController.js
sed -i 's/\.\/webview\/Picker/\.\/webview\/picker/ig' app/dist/components/simulator/controller.js
sed -i 's/\.\/webview\/ActionSheet\.js/\.\/webview\/actionSheet\.js/ig' app/dist/components/simulator/controller.js
sed -i 's/appServiceConfig\.js/appserviceConfig\.js/ig' app/dist/common/assdk/networkSdk.js

After the execution is completed, enter the directory:


##

nw .

You can open the small file normally If the program development tool prompts "failed to load..." when opening it, it is because the icon file cannot be loaded. You can edit "icon": "app/images/logo2.png" in package.json to another ico file or delete this line directly.

Supplement:

need npm install before running nw.


I still need to install several modules separately locally:



npm install --save autoprefixer
npm install --save pretty
npm install --save perfectionist

Thank you for reading, I hope it can help everyone, thank you for your support Support from this site!

The above is the detailed content of Introduction to Linux development environment settings for WeChat mini programs. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn