How to run an existed language server without vscode - node.js

I am trying to develop my own IDE with language server protocol support, so i download language server written in typescript and try to start them with Node.js.
First, I packaged the server package with webpack. and then start with the command "node server.js", server.js is produced by webpack. but I got
Error: Connection input stream is not set. Use arguments of createConnection or set command line parameters: '--node-ipc', '--stdio' or '--socket={number}'
at D:\GitHub\vscode-autohotkey2-lsp\server\dist\server.js:1:172642
at t.createConnection (D:\GitHub\vscode-autohotkey2-lsp\server\dist\server.js:1:179222)
at Object.999 (D:\GitHub\vscode-autohotkey2-lsp\server\dist\server.js:1:72865)
at n (D:\GitHub\vscode-autohotkey2-lsp\server\dist\server.js:1:186299)
at D:\GitHub\vscode-autohotkey2-lsp\server\dist\server.js:1:186653
at Object.<anonymous> (D:\GitHub\vscode-autohotkey2-lsp\server\dist\server.js:1:186661)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
then I followed the Error information, replaced the command with "node server.js --node-ipc". the error above didn't appear again, but i didn't got a server process in my Windows task manager.
I am new to typescript and language-server-protocol, did I got sth wrong or misunderstand sth?

Related

NextJS build error - ReferenceError: navigator is not defined

I'm running into this special error message while trying to build a simple NextJS application (using npm run build):
> Build error occurred
ReferenceError: navigator is not defined
at /cdk-next/next-frontend/node_modules/codemirror/lib/codemirror.js:18:19
at /cdk-next/next-frontend/node_modules/codemirror/lib/codemirror.js:11:83
at Object.<anonymous> (/cdk-next/next-frontend/node_modules/codemirror/lib/codemirror.js:14:2)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (/cdk-next/next-frontend/node_modules/easymde/src/js/easymde.js:2:18) {
type: 'ReferenceError'
}
info - Collecting page data .
I don't know who codemirror is, or why it's not letting me build my project. From reading around I gather that this issue occurs with NextJS when trying to build a project on the server side instead of the client side, because the project does not have access to a window or navigator. In that case, what should I do? The tutorial I'm following seems to breeze through this step just fine, so should I just look at their package.json and downgrade all of my packages? Any advice would be appreciated.
The error was with my import of import SimpleMDE from "react-simplemde-editor" (located in create-post.js of the repo link above).
I implemented the solution proposed by modikum here: https://github.com/dabit3/next.js-amplify-workshop/issues/21.
Now the project builds successfully.

Getting an error when running "npx wdio config"

I get the following error when I try to set up "Hello World" test suite into my project by running: "npx wdio config". I followed the instructions on the https://webdriver.io/docs/gettingstarted and still not able to get it to work.
Can someone help me with resolving this:
WDIO Configuration Helper
? Where is your automation backend located? (Use arrow keys)
❯ On my local machine
In the cloud using Experitest
In the cloud using Sauce Labs
In the cloud using Browserstack or Testingbot or LambdaTest or a different service
I have my own Selenium cloud (node:2831) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'find' of undefined
at Object.run (/Users/gustavosuarez/web/mo-appium-wdio-jasmine/node_modules/#wdio/cli/build/index.js:67:19)
at Object.<anonymous> (/Users/gustavosuarez/web/mo-appium-wdio-jasmine/node_modules/#wdio/cli/bin/wdio.js:11:21)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
at internal/main/run_main_module.js:17:47
Seems to be a problem with the latest version of the #wdio/cli dependency. I solved the problem by using an older version and it works now ("#wdio/cli": "7.3.1"). Just add that dependency to your package.json and run yarn or npm install again, then npx wdio config and it should work.

ReferenceError: window is not defined in godash

I am trying to build a board game and want to use godash to create a board state and update it. I have successfully installed godash into my package.json, but when I require it in the back-end, in my server.js (the file in which I run my server),
var godash = require ('godash');
and I run node server.js, the CLI responds with this error:
ReferenceError: window is not defined
at Object.<anonymous> (C:\Users\Chidi\gt\projects\Chess-vs-Go\node_modules\godash\dist\godash.js:1:194)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.<anonymous> (C:\Users\Chidi\gt\projects\Chess-vs-Go\game_state\go_state.js:2:14)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
I've seen various "window is not defined" questions on this site in my effort to solve this problem, and the general solution seems to be that the code should be used in a browser environment. However, this is godash, an npm package that is to be used in the back-end. I have tried updating node.js and npm to their latest versions, but the problem still persists. I feel like I am making an obvious error that I can't see, because I went to the github page for godash and did not find any closed or open issues similar to this one. Does anyone know what the issue is, and how I can resolve it?
So, upon further research, I found that there are ways to use npm packages in the browser (e.g via browserify) This allowed me to use godash in the browser, where it was looking for a window object.

Error pointing to non-existent file when running Node.js app locally

I was just sent the files for a Node.js app (which is working without issues online) and I'm trying to set it up on my Windows machine.
I have Node server running, but I'm stuck trying to actually load the app. I can navigate to the directory with the Node command prompt, and there's an app.js (plus folders like config, components etc) in there which I've been trying to run, but I am getting the following error:
D:\my-directory\game-master>node app.js
module.js:327
throw err;
^
Error: Cannot find module 'config'
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (D:\posao\aktivni projekti\smart rebellion\game-master
\app.js:7:10)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Function.Module.runMain (module.js:441:10)
The thing is, there is no file titled module.js in the directory. I presume it's a built in Node.js file, but then how do I troubleshoot this?
My best reading of the error is that there should be a config.js file somewhere, but that doesn't make sense because these same exact files work with no hickups on a remote server.
If you want to require('./config'), where config is a directory, the file ./config/index.js should exist.
You can't require('config') however, because node.js will try to find it in node_modules.
Check out node.js modules documentation where the require algorithm is well explained.

Use edge js on openshift

I'm trying to run C# on my OpenShift cartridge with Edge.js. It runs really good on my Windows PC and I would like to have it running on the cloud.
I'm guessing it runs on a Linux environment but I'm not shure.
At first I tried to make it work with my MSSQL DB and than move on to the C# assembly.
Nevertheless I'm doing the same steps as how I've got it to work on my Windows machine but I'm getting thesame errors over and over again.
I've added edge and edge-sql to my npm and my package.json.
Then I've make a simple count to my MSSQL DB.
When I'm running it locally it works great. Than I push it to OpenShift and I tail the application, because the front-end gives me an Error 503, and the next thing I know the following error makes me keepings my hands in my hair.
Error: The edge native module is not available at /var/lib/openshift/54d26260fcf
933d05e00021a/app-root/runtime/repo/node_modules/edge/build/Release/edge.node. Y
ou can use EDGE_NATIVE environment variable to provide alternate location of edg
e.node. If you need to build edge.node, follow build instructions for your platf
orm at https://github.com/tjanczuk/edge
at Object.<anonymous> (/var/lib/openshift/54d26260fcf933d05e00021a/app-root/
runtime/repo/node_modules/edge/lib/edge.js:33:11)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/var/lib/openshift/54d26260fcf933d05e00021a/app-root/
runtime/repo/server.js:5:12)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
DEBUG: Program node server.js exited with code 8
DEBUG: Starting child process with 'node server.js'
/var/lib/openshift/54d26260fcf933d05e00021a/app-root/runtime/repo/node_modules/e
dge/lib/edge.js:33
throw new Error('The edge native module is not available at ' + builtEdge
Could somebody help me to fix this error or maybe explain to me why it could / wont work?
If edge requires a native windows environment to run C#, then it will not work on OpenShift, which runs on Red Hat Linux.

Resources