Everlaw / nbts

NetBeans TypeScript editor plugin
283 stars 46 forks source link

error communicating with Node.js process #100

Open lesar opened 7 years ago

lesar commented 7 years ago

I have Ubuntu 16.04.1 64bit
NetBeansIDE 8.2 Java 1.8.0_121-b13 Node v7.7.4 NetBeansTypeScript 2.1.5.3

On tsconfig.json in compilerOptions I get

error communicating with Node.js process

On other file *.ts I get

Unknown source Root file ...Path...

Can you help? Have I to give you some more data?

regards,
Leonardo

cyraid commented 7 years ago

I also never have been able to get TypeScript for NetBeans up and running.. It seems like no developers of this plugin are responding to these issues? Is it dead?

Edit again: Found out the actual problem I've been having this entire time. Since my Javascript was in "ECMAScript 7" mode.. It was head-butting with TypeScript. Renaming ".ts" extension of the file to ".tsx" worked for me!

Edit: I found out the "error communicating with Node.js process" can be solved with moving the tsconfig.json to your "source root" folder in the project.. I'm still getting errors when I open a ".ts" file, and the parser breaks on:

class SomeClass { s : string; }

"Expected ; but found :" ..

mkoe-unitb commented 7 years ago

I have the same issue. But the workarounds from cyraid didn't work for me. Did someone found another fix?

dipacs commented 7 years ago

You can define environment variables to netbeans as described here: http://wiki.netbeans.org/MacOSXEnvForApp

Just make sure your node executable is in the PATH (like: /user/local/bin)

For me, this worked well.

geekdenz commented 7 years ago

Currently it relies on an environment variable PATH to include the bin folder where the node executable is installed. I ran into this same issue when I started the IDE from the Ubuntu menu (Dash or Gnome).

You may want to set your PATH variable up like so: https://askubuntu.com/questions/4667/where-to-declare-environment-variables#26411

Or just start NetBeans from the command line where you have your Node.JS working in an environment like NVM.

If all else fails, try

PATH=/path/to/nodejs/bin:$PATH /path/to/netbeans/bin/netbeans &

I personally think that the plugin or NetBeans (better) should support NVM and Node.JS environments that the user can set in Options. However, I may not get to doing this so soon. I'm re-evaluating the plugin again, because I had some trouble with my VIM setup which works well again also and in fact faster than NetBeans. But I know VIM is not for everyone and even at the organisation I work people are using IDEs like NetBeans with more pleasure and ease of use. Also, for Java I still use NetBeans and it is definitely superior to VIM for Java even though I don't mind keyboard shortcuts.

Long story short: I am considering taking up supporting this plugin again, also because TypeScript is probably my best PL now and I like it even more since it is part of NativeScript.

geekdenz commented 7 years ago

FYI, I added this to my ~/.profile

export PATH=/absolute/path/to/nodejs/bin:$PATH
qbixus commented 6 years ago

In my case, a TypeScript project's artifacts (package.json, tsconfig.json, gulpFile.js etc) are located under /src/main/js folder of some Maven project (i.e. it is a "nested project" of that Maven project). NetBeans let me open this nested project as a separate project in Projects View by "Open Project Of Folder" in the context menu. If I open it, everything works well.

But if I DO NOT have nested project opened as a separate project in Project View and try to open my .ts files (src/main/js/src/example.ts) and my tsconfig.json file (src/main/js/tsconfig.json) directly from Maven project's Project View node, I get both issues mentioned around: "Error communicating ..." error for tsconfig.json and "Unknown source root..." for .ts files. If I DO have nested project opened as a separate project, everything works well in this case too.

In short, it does work only if my nested project is opened as a separate project in Project View.

Usually, I do not open nested projects or even configure them in NetBeans (Site Root-s, Source Root-s and so on in project's properties) and edit files directly from Maven project's source trees. It's really nice and works well given integrated build process.

Hope, this will help to identify and fix the issue.