Previous: Theia architecture
Build your own IDE
This guide will teach you how to build your own Theia applications.
Requirements
You need to install the node 10 version (Translator: in fact the latest stable version of the node can):
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.5/install.sh | bash nvm install 10
And yarn:
npm install -g yarn
Also you need to make sure python 2.x has been installed by python --version to check.
installation
First, create an empty directory, then switch to this directory:
mkdir my-app cd my-app
Created under this directory package.json :
{ "private": true, "dependencies": { "typescript": "latest", "@theia/typescript": "next", "@theia/navigator": "next", "@theia/terminal": "next", "@theia/outline-view": "next", "@theia/preferences": "next", "@theia/messages": "next", "@theia/git": "next", "@theia/file-search": "next", "@theia/markers": "next", "@theia/preview": "next", "@theia/callhierarchy": "next", "@theia/merge-conflicts": "next", "@theia/search-in-workspace": "next", "@theia/json": "next", "@theia/textmate-grammars": "next", "@theia/mini-browser": "next" }, "devDependencies": { "@theia/cli": "next" } }
In short, Theia application and expansion packs are Node.js package . Each packet contains a package.json file, which lists some metadata packet, such as name, Version , build and run-time dependencies like.
- name and version is omitted, because we do not intend to use it as a dependency. At the same time it is marked as Private , because they do not intend to publish it as a separate Node.js package.
- We list all dependent runtime extension package dependencies, as @ Theia / Navigator .
- Some expansion packs require additional tools to install, for example, @ Theia / Python requires Python Language Server to install. In this case you need to refer to the appropriate documentation.
- Can in here to see all expansion packs have been released.
- We will @ theis / cli listed as dependencies when building, it provides a script to build and run applications.
Construct
First, install all of the dependencies.
yarn
Then, using Theia CLI to build applications.
yarn theia build
yarn look at the context of our application @ theia / cli provided theia executable file, and then use theia execute build command. This may take some time, because the application will be built in a production mode by default, that it will obfuscate and minimize processing.
run
After the build is complete, we can start the application:
yarn theia start
You can specify a workspace path in the first parameter in the command, --hostname and --port options for the host name and port number specified deployment. For example, the following command opens the specified location on the port number and / Workspace :
yarn theia start /my-workspace --hostname 0.0.0.0 --port 8080
In the terminal, you should see Theia application has started and monitoring:
Open a browser and enter the address shown above, you can open the application.
Troubleshooting
Build local dependencies by proxy
If you run through a proxy yarn command, it is possible to build local dependencies encounter some problems (such as onigurma ), for example, the following error:
[4/4] Building fresh packages... [1/9] XXXXX [2/9] XXXXX [3/9] XXXXX [4/9] XXXXX error /theiaide/node_modules/XXXXX: Command failed. Exit code: 1 Command: node-gyp rebuild Arguments: Directory: /theiaide/node_modules/XXXXX Output: gyp info it worked if it ends with ok gyp info using node-gyp@3.8.0 gyp info using node@8.15.0 | linux | x64 gyp http GET https://nodejs.org/download/release/v8.15.0/node-v8.15.0-headers.tar.gz gyp WARN install got an error, rolling back install gyp ERR! configure error gyp ERR! stack Error: read ECONNRESET gyp ERR! stack at TLSWrap.onread (net.js:622:25) gyp ERR! System Linux 3.10.0-862.11.6.el7.x86_64 gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" gyp ERR! cwd /theiaide/node_modules/XXXXX gyp ERR! node -v v8.15.0
This is because the node-gyp proxy settings do not work in the system / NPM's. If this happens, the error stack can be downloaded via the link provided in the node-headers file (as in the example above https://nodejs.org/download/release/v8.15.0/node-v8.15.0-headers. the tar.gz ), then use the following commands Construction:
npm_config_tarball=/path/to/node-v8.15.0-headers.tar.gz yarn install
Original Address: https://theia-ide.org/docs/composing_applications/