Setup Develop Environment#
Using dotWe is a good choice, but if you want to develop locally on your own machine, you will need to set up your develop environment.
You will need Node.js and the Weex CLI.
Install Node.js using nvm (Simple bash script to manage multiple active Node.js versions). Run the following commands in a terminal after installing nvm:
$ nvm install 6.10.0
npm comes with Node.js, with which you can install the Weex command line tools.
NOTE: After upgrading the
weex-toolkitto v1.0.8, the
npm-shrinkwrap.jsonnpm 5 specification has been added to lock the package dependencies, it is needed to upgrade your npm version to 5 above by command:
npm install npm @latest -gif your version is lower than this, please check your npm version before using it.
Run the following commands in a terminal:
$ npm install -g weex-toolkit
You can use ‘weex update
weex update weex-devtool@latest // Here latest means to install the latest version
NOTE: If you receive an error like
permission error, check out where permission problems occur, please delete the corresponding file and reinstall or run the
chmod -R 777 [path]command to authorize.
Then you can use the Weex command to verify if the installation is successful:
Generate a new Weex project#
Use the command line tool to generate a Weex project called “awesome-project”. Run the following command in a terminal:
$ weex create awesome-project
Then enter the awesome-project folder, you will see a standard project skeleton has been generated.
weex-toolkit will prompt you whether to automatically run
npm install, if not running, manually into the folder and run
awesome-project folder, install dependencies with the following command:
It will open the preview server automaticly, if you just want to see the web site, you can visite
NOTE When the port number is occupied, the port number may change, please pay attention to the console output.
| —— configs
For more technical details, please continue to read the next section. And don’t forget to write and preview your codes at dotWe.