edge
edge copied to clipboard
Inner Exception SyntaxError: Unexpected token ...
I'm running the demo ws script from the readme page:
public static async void Start()
{
var createWebSocketServer = Edge.Func(@"
var WebSocketServer = require('ws').Server;
return function (port, cb) {
var wss = new WebSocketServer({ port: port });
wss.on('connection', function (ws) {
ws.on('message', function (message) {
ws.send(message.toUpperCase());
});
ws.send('Hello!');
});
cb();
};
");
await createWebSocketServer(8080);
}
Task.Run(Start);
new ManualResetEvent(false).WaitOne();
But I'm getting an error:
Exception: D:\Documents\Visual Studio
Projects\DiscordConsoleClient\bin\Debug\node_modules\ws\lib\websocket.js:348
...options
^^^
SyntaxError: Unexpected token ...
at createScript (vm.js:74:10)
at Object.runInThisContext (vm.js:116:10)
at Module._compile (module.js:533:28)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
at Module.require (module.js:513:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (D:\Documents\Visual Studio
Projects\DiscordConsoleClient\bin\Debug\node_modules\ws\index.js:3:19)
Any idea what's wrong?
Same here
I have the same problem. Any update on this issue?
I also reported the problem here:
https://stackoverflow.com/q/71807544/4180447
I confirmed if I use newman version 4.6.1
the problem will be resolved. Also, I think if I use Babel to transpile all the newman code in the node_modules
folder, then it will work, but how to do that?
If I managed to transpile all code under node_modules
and the output is node_modules_dist
then how it will be picked up with the node API const newman=require("newman")
?