Develop WeChat applets under Linux

angryTom
Release: 2020-03-25 14:19:05
forward
5617 people have browsed it

本篇文章介绍了如何在Linux环境下使用微信开发者工具开发小程序,希望对各位有帮助!

Develop WeChat applets under Linux

在Linux下开发微信小程序

微信小程序开发工具是用nw.js实现的,这玩意本来就可以跨平台的。搞不懂为什么微信只出了windows和mac版。今天我捣腾了一下,可以在linux下开发微信小程序了。以ubuntu为例:

首先要安装nwjs sdk环境,因为需要devtool的支援, 一定要安装sdk版本。

下载nwjs sdk压缩包之后解压放到你喜欢的位置,并且设置环境变量,nw可执行文件加入到path变量中。

接下来要去提取微信小程序开发工具的package.nw文件,这是nwjs的项目包文件。找个window机器安装一下小程序开发工具,在安装目录里找到package.nw文件夹,将文件夹拷贝到linux系统下。按理来说,进入这个文件夹nw .就可以运行了,但是你会发现报错了,因为腾讯的开发者在项目的文件引用中大小写不分,能在windows上运行,linux下就不行。知道了原因,我们就将引用错误的地方修正。在package.nw目录下执行:

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
Copy after login

执行完成之后进入目录:

nw .
Copy after login

可以正常打开小程序开发工具了,如果打开的时候提示“failed to load...”错误提示是因为图标文件无法加载的原因。你可以编辑一下package.json里面的icon: app/images/logo2.png为其他ico文件或者直接删掉这一行即可。

PHP中文网,大量免费小程序开发教程,欢迎学习!

The above is the detailed content of Develop WeChat applets under Linux. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:zixun.jisuapp.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!