New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix fs path accesses in the plugin system #4213

Open
fiurthorn opened this Issue Feb 1, 2019 · 7 comments

Comments

Projects
None yet
2 participants
@fiurthorn
Copy link

fiurthorn commented Feb 1, 2019

Get this message on windows when i try to start a hosted server for development.

root ERROR Uncaught Exception:  Error: Invalid listen argument: [ 6789, 3030 ]
root ERROR Error: Invalid listen argument: [ 6789, 3030 ]
    at Server.listen (net.js:1501:9)
    at BackendApplication.<anonymous> (c:\fiurthorn\workspace\toolbox\data\runtime\theia\node_modules\@theia\core\lib\node\backend-application.js:273:32)
    at step (c:\fiurthorn\workspace\toolbox\data\runtime\theia\node_modules\@theia\core\lib\node\backend-application.js:59:23)
    at Object.next (c:\fiurthorn\workspace\toolbox\data\runtime\theia\node_modules\@theia\core\lib\node\backend-application.js:40:53)
    at c:\fiurthorn\workspace\toolbox\data\runtime\theia\node_modules\@theia\core\lib\node\backend-application.js:34:71
    at new Promise (<anonymous>)
    at __awaiter (c:\fiurthorn\workspace\toolbox\data\runtime\theia\node_modules\@theia\core\lib\node\backend-application.js:30:12)
    at BackendApplication.start (c:\fiurthorn\workspace\toolbox\data\runtime\theia\node_modules\@theia\core\lib\node\backend-application.js:217:16)
    at c:\fiurthorn\workspace\toolbox\data\runtime\theia\src-gen\backend\server.js:34:28
    at <anonymous>
root ERROR Failed to load plugin metadata from "/c:/fiurthorn/workspace/theia-hello-world-plugin/" Error: ENOENT: no such file or directory, open 'c:\c:\fiurthorn\workspace\theia-hello-world-plugin\package.json'
Hosted instance has been terminated
@theia/core 0.4.0-testnext.d1b1bc8c
@theia/output 0.4.0-testnext.d1b1bc8c
@theia/process 0.4.0-testnext.d1b1bc8c
@theia/filesystem 0.4.0-testnext.d1b1bc8c
@theia/variable-resolver 0.4.0-testnext.d1b1bc8c
@theia/workspace 0.4.0-testnext.d1b1bc8c
@theia/languages 0.4.0-testnext.d1b1bc8c
@theia/editor 0.4.0-testnext.d1b1bc8c
@theia/navigator 0.4.0-testnext.d1b1bc8c
@theia/markers 0.4.0-testnext.d1b1bc8c
@theia/outline-view 0.4.0-testnext.d1b1bc8c
@theia/monaco 0.4.0-testnext.d1b1bc8c
@theia/callhierarchy 0.4.0-testnext.d1b1bc8c
@theia/file-search 0.4.0-testnext.d1b1bc8c
@theia/git 0.4.0-testnext.d1b1bc8c
@theia/json 0.4.0-testnext.d1b1bc8c
@theia/merge-conflicts 0.4.0-testnext.d1b1bc8c
@theia/messages 0.4.0-testnext.d1b1bc8c
@theia/mini-browser 0.4.0-testnext.d1b1bc8c
@theia/console 0.4.0-testnext.d1b1bc8c
@theia/terminal 0.4.0-testnext.d1b1bc8c
@theia/debug 0.4.0-testnext.d1b1bc8c
@theia/userstorage 0.4.0-testnext.d1b1bc8c
@theia/preferences 0.4.0-testnext.d1b1bc8c
@theia/task 0.4.0-testnext.d1b1bc8c
@theia/plugin-ext 0.4.0-testnext.d1b1bc8c
@theia/preview 0.4.0-testnext.d1b1bc8c
@theia/search-in-workspace 0.4.0-testnext.d1b1bc8c
@theia/textmate-grammars 0.4.0-testnext.d1b1bc8c
@theia/typescript 0.4.0-testnext.d1b1bc8c
@akosyakov

This comment has been minimized.

Copy link
Member

akosyakov commented Feb 1, 2019

We should make sure that we always use FileUri.fsPath on backend and FilesSystem.getFsPath on frontend to retrieve fs paths from URIs in the @theia/plugin-ext and @theia/plugin-ext-vscode, otherwise it is not going to work on Windows.

@akosyakov

This comment has been minimized.

Copy link
Member

akosyakov commented Feb 1, 2019

@fiurthorn Could you investigate further? PRs are always very welcomed.

@akosyakov akosyakov changed the title Wrong Windows root detection fix fs path accesses in the plugin system Feb 1, 2019

@fiurthorn

This comment has been minimized.

Copy link
Author

fiurthorn commented Feb 1, 2019

I'm interested, but I need more informations or a little development guide.

@fiurthorn

This comment has been minimized.

Copy link
Author

fiurthorn commented Feb 4, 2019

Tested on Windiws Linux Subsystem omit the windows Path Exception,
but keep failing to start the hosted Workspace

root ERROR Failed to start the backend application.
root ERROR TypeError [ERR_INVALID_ARG_VALUE]: The argument 'options' must have the property "port" or "path". Received [ 6786, 3030 ]
    at Server.listen (net.js:1429:11)
@fiurthorn

This comment has been minimized.

Copy link
Author

fiurthorn commented Feb 4, 2019

tried following fix at backend-application.js@224:32 to get it working:

port = aPort !== undefined ? aPort : this.cliParams.port;
* port = Array.isArray(port) ? port[port.length - 1] : port
@akosyakov

This comment has been minimized.

Copy link
Member

akosyakov commented Feb 5, 2019

Regarding this error:

root ERROR Failed to load plugin metadata from "/c:/fiurthorn/workspace/theia-hello-world-plugin/" Error: ENOENT: no such file or directory, open 'c:\c:\fiurthorn\workspace\theia-hello-world-plugin\package.json'

You can start investigation here:

this.logger.error(`Failed to load plugin metadata from "${pluginPath}"`, e);

And inspect how do you get such bogus path.

@akosyakov

This comment has been minimized.

Copy link
Member

akosyakov commented Feb 5, 2019

The start command for a hosted server is created here:

protected async getStartCommand(port?: number, debugConfig?: DebugConfiguration): Promise<string[]> {

It would be interesting to debug it and see a reason for Error: Invalid listen argument: [ 6789, 3030 ].

Check the debug view, there is a configuration to debug Theia backend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment