WeChat applet Linux development environment Settings

  • 2020-05-17 07:21:54
  • OfStack

WeChat applet Linux development environment

The WeChat applet development tool is implemented using nw.js, which is inherently cross-platform. I don't know why WeChat only comes out with windows and mac. Today I made a monkey out of 1, can be in linux under the development of WeChat small program. Take ubuntu for example:

The nwjs sdk environment needs to be installed first, since devtool support is required, so the sdk version must be installed.

After downloading the nwjs sdk zip, unzip it to your favorite location and set the environment variable. The nw executable is added to the path variable.

The next step is to extract the package.nw file of the WeChat applet development tool, which is the project package file of nwjs. Find the package.nw folder in the installation directory. Copy the folder to the linux system. In principle, enter this folder and nw will be ready to run, but you will notice that there is an error, because tencent's developers can run on windows, but not linux, regardless of the case in the project's file references. Knowing the reason, we fix where the quote is wrong. Execute under 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

Enter the directory after execution:


nw .

Can open the small program development tool normally, if the opening of the prompt "failed to load..." The error is because the icon file could not be loaded. . You can edit one package json inside "icon" : "app/images/logo2. png" for other ico file or delete the 1 row can directly.

Supplement:

You need npm install before running nw.

I also 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 to help you, thank you for your support of this site!


Related articles: