无法在 Theia 上快速启动

Not able to Quick Start on Theia

我正在尝试使用 theia 创建 PoC。经历 https://github.com/theia-ide/theia/blob/master/doc/Developing.md

运行 它在 Ubuntu 16.04。 git 克隆 https://github.com/theia-ide/theia 完成。但是当我试图 运行 yarn;我收到以下错误:

ubuntu@ip-172-30-0-179:~/theia/theia$ yarn
yarn install v1.9.4
[1/5] Validating package.json...
[2/5] Resolving packages...
success Already up-to-date.
$ yarn rebuild:clean && yarn build:clean
yarn run v1.9.4
$ rimraf .browser_modules
Done in 0.20s.
yarn run v1.9.4
$ run prepare
lerna info version 2.11.0
@theia/ext-scripts: $ echo 'skip'
@theia/ext-scripts: skip
@theia/application-package: $ yarn run clean && yarn run build
@theia/plugin: $ yarn run clean && yarn run build
@theia/application-package: $ theiaext clean
@theia/plugin: $ theiaext clean
@theia/application-package: $ theiaext build
@theia/plugin: $ theiaext build
@theia/plugin: [compile] Killed
@theia/plugin: [compile] theiaext compile exited with code 137
@theia/plugin: [lint] Killed
@theia/plugin: [lint] theiaext lint exited with code 137
@theia/plugin: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
@theia/plugin: error Command failed with exit code 1.
@theia/plugin: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
@theia/plugin: error Command failed with exit code 1.
lerna ERR! execute callback with error
lerna ERR! Error: Command failed: yarn run prepare
lerna ERR! error Command failed with exit code 1.
lerna ERR! error Command failed with exit code 1.
lerna ERR!
lerna ERR! $ yarn run clean && yarn run build
lerna ERR! $ theiaext clean
lerna ERR! $ theiaext build
lerna ERR! [compile] Killed
lerna ERR! [compile] theiaext compile exited with code 137
lerna ERR! [lint] Killed
lerna ERR! [lint] theiaext lint exited with code 137
lerna ERR! info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
lerna ERR! info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
lerna ERR!
lerna ERR!     at Promise.all.then.arr (/home/ubuntu/theia/theia/node_modules/lerna/node_modules/execa/index.js:236:11)
lerna ERR!     at <anonymous>
lerna WARN complete Waiting for 1 child process to exit. CTRL-C to exit immediately.
@theia/application-package: [lint] theiaext lint exited with code 0
@theia/application-package: [compile] theiaext compile exited with code 0
{ Error: Command failed: yarn run prepare
error Command failed with exit code 1.
error Command failed with exit code 1.

$ yarn run clean && yarn run build
$ theiaext clean
$ theiaext build
[compile] Killed
[compile] theiaext compile exited with code 137
[lint] Killed
[lint] theiaext lint exited with code 137
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

    at Promise.all.then.arr (/home/ubuntu/theia/theia/node_modules/lerna/node_modules/execa/index.js:236:11)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
  code: 1,
  killed: false,
  stdout: '$ yarn run clean && yarn run build\n$ theiaext clean\n$ theiaext build\n[compile] Killed\n[compile] theiaext compile exited with code 137\n[lint] Killed\n[lint] theiaext lint exited with code 137\ninfo Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.\ninfo Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.\n',
  stderr: 'error Command failed with exit code 1.\nerror Command failed with exit code 1.\n',
  failed: true,
  signal: null,
  cmd: 'yarn run prepare',
  timedOut: false,
  exitCode: 1 }
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

增加内存后;我收到以下错误:

error /home/ubuntu/theia/node_modules/vscode-nsfw: Command failed. Exit code: 1

完整的控制台是:

ubuntu@ip-10-169-135-35:~/theia$ yarn
yarn install v1.9.4
[1/5] Validating package.json...
[2/5] Resolving packages...
[3/5] Fetching packages...
[-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------] 0/1648(node:4457) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
warning monaco-languageclient@0.9.0: The engine "vscode" appears to be invalid.
warning vscode-base-languageclient@4.4.0: The engine "vscode" appears to be invalid.
info fsevents@1.2.4: The platform "linux" is incompatible with this module.
info "fsevents@1.2.4" is an optional dependency and failed compatibility check. Excluding it from installation.
[4/5] Linking dependencies...
warning " > istanbul-instrumenter-loader@3.0.1" has unmet peer dependency "webpack@^2.0.0 || ^3.0.0 || ^4.0.0".
warning "workspace-aggregator-e2635a1a-c6a1-46eb-92c2-8d23c5dea8b0 > @theia/application-manager > font-awesome-webpack@0.0.5-beta.2" has unmet peer dependency "font-awesome@>=4.3.0".
[5/5] Building fresh packages...
[1/9] ⠄ fibers
[7/9] ⠄ dugite
[3/9] ⡀ electron
[4/9] ⡀ vscode-nsfw
error /home/ubuntu/theia/node_modules/vscode-nsfw: Command failed.
Exit code: 1
Command: node-gyp rebuild
Arguments:
Directory: /home/ubuntu/theia/node_modules/vscode-nsfw
Output:
gyp info it worked if it ends with ok
gyp info using node-gyp@3.8.0
gyp info using node@10.10.0 | linux | x64
gyp info spawn /usr/bin/python2
gyp info spawn args [ '/home/ubuntu/theia/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/home/ubuntu/theia/node_modules/vscode-nsfw/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/ubuntu/theia/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/ubuntu/.node-gyp/10.10.0/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/home/ubuntu/.node-gyp/10.10.0',
gyp info spawn args   '-Dnode_gyp_dir=/home/ubuntu/theia/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/home/ubuntu/.node-gyp/10.10.0/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/home/ubuntu/theia/node_modules/vscode-nsfw',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
make: Entering directory `/home/ubuntu/theia/node_modules/vscode-nsfw/build'
  CXX(target) Release/obj.target/nsfw/src/NSFW.o
../src/NSFW.cpp: In static member function ‘static void NSFW::fireErrorCallback(uv_async_t*)’:
../src/NSFW.cpp:56:44: warning: ‘v8::Local<v8::Value> Nan::Callback::Call(int, v8::Local<v8::Value>*) const’ is deprecated (declared at ../../nan/nan.h:1618) [-Wdeprecated-declarations]
   baton->nsfw->mErrorCallback->Call(1, argv);
                                            ^
../src/NSFW.cpp: In static member function ‘static void NSFW::fireEventCallback(uv_async_t*)’:
../src/NSFW.cpp:98:44: warning: ‘v8::Local<v8::Value> Nan::Callback::Call(int, v8::Local<v8::Value>*) const’ is deprecated (declared at ../../nan/nan.h:1618) [-Wdeprecated-declarations]
   baton->nsfw->mEventCallback->Call(1, argv);
                                            ^
../src/NSFW.cpp: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE NSFW::JSNew(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/NSFW.cpp:159:49: error: no matching function for call to ‘v8::Function::NewInstance()’
     info.GetReturnValue().Set(cons->NewInstance());
                                                 ^
../src/NSFW.cpp:159:49: note: candidates are:
In file included from /home/ubuntu/.node-gyp/10.10.0/include/node/node.h:63:0,
                 from ../../nan/nan.h:51,
                 from ../src/../includes/NSFW.h:5,
                 from ../src/NSFW.cpp:1:
/home/ubuntu/.node-gyp/10.10.0/include/node/v8.h:3989:44: note: v8::MaybeLocal<v8::Object> v8::Function::NewInstance(v8::Local<v8::Context>, int, v8::Local<v8::Value>*) const
   V8_WARN_UNUSED_RESULT MaybeLocal<Object> NewInstance(
                                            ^
/home/ubuntu/.node-gyp/10.10.0/include/node/v8.h:3989:44: note:   candidate expects 3 arguments, 0 provided
/home/ubuntu/.node-gyp/10.10.0/include/node/v8.h:3992:44: note: v8::MaybeLocal<v8::Object> v8::Function::NewInstance(v8::Local<v8::Context>) const
   V8_WARN_UNUSED_RESULT MaybeLocal<Object> NewInstance(
                                            ^
/home/ubuntu/.node-gyp/10.10.0/include/node/v8.h:3992:44: note:   candidate expects 1 argument, 0 provided
../src/NSFW.cpp:177:54: warning: ‘v8::String::Utf8Value::Utf8Value(v8::Local<v8::Value>)’ is deprecated (declared at /home/ubuntu/.node-gyp/10.10.0/include/node/v8.h:2887): Use Isolate version [-Wdeprecated-declarations]
   v8::String::Utf8Value utf8Value(info[1]->ToString());
                                                      ^
../src/NSFW.cpp: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE NSFW::Start(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/NSFW.cpp:208:27: warning: ‘v8::Local<v8::Value> Nan::Callback::Call(int, v8::Local<v8::Value>*) const’ is deprecated (declared at ../../nan/nan.h:1618) [-Wdeprecated-declarations]
     callback->Call(1, argv);
                           ^
../src/NSFW.cpp: In member function ‘virtual void NSFW::StartWorker::HandleOKCallback()’:
../src/NSFW.cpp:254:27: warning: ‘v8::Local<v8::Value> Nan::Callback::Call(int, v8::Local<v8::Value>*) const’ is deprecated (declared at ../../nan/nan.h:1618) [-Wdeprecated-declarations]
     callback->Call(1, argv);
                           ^
../src/NSFW.cpp:256:27: warning: ‘v8::Local<v8::Value> Nan::Callback::Call(int, v8::Local<v8::Value>*) const’ is deprecated (declared at ../../nan/nan.h:1618) [-Wdeprecated-declarations]
     callback->Call(0, NULL);
                           ^
../src/NSFW.cpp: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE NSFW::Stop(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/NSFW.cpp:281:27: warning: ‘v8::Local<v8::Value> Nan::Callback::Call(int, v8::Local<v8::Value>*) const’ is deprecated (declared at ../../nan/nan.h:1618) [-Wdeprecated-declarations]
     callback->Call(1, argv);
                           ^
../src/NSFW.cpp: In member function ‘virtual void NSFW::StopWorker::HandleOKCallback()’:
../src/NSFW.cpp:323:25: warning: ‘v8::Local<v8::Value> Nan::Callback::Call(int, v8::Local<v8::Value>*) const’ is deprecated (declared at ../../nan/nan.h:1618) [-Wdeprecated-declarations]
   callback->Call(0, NULL);
                         ^
make: *** [Release/obj.target/nsfw/src/NSFW.o] Error 1
make: Leaving directory `/home/ubuntu/theia/node_modules/vscode-nsfw/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/ubuntu/theia/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:240:12)
gyp ERR! System Linux 3.13.0-86-generic
gyp ERR! command "/usr/local/bin/node" "/home/ubuntu/theia/node_modules/.bin/node-gyp" "rebuild"
gyp ERR! cwd /home/ubuntu/theia/node_modules/vscode-nsfw

非常感谢任何帮助。

这实际上不是我解决的,而是@kittaakos(创建了这个很棒的平台 theia 的人)解决的

所以,总结一下:

  1. 确保您的 VM 有足够的 RAM,例如 4 GB。它甚至可以使用 2 GB。所以,如果你得到退出代码 137;尝试升级内存。
  2. 它在 Node.js 8.11.4
  3. 上非常有效
  4. 出于安全考虑,默认情况下它在本地主机上启动。如果您希望它通过外部 IP 公开;使用

$ yarn run start --hostname 0.0.0.0