Skip to content
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

Errors building and running express example #123

Open
theJenix opened this issue Oct 11, 2022 · 3 comments
Open

Errors building and running express example #123

theJenix opened this issue Oct 11, 2022 · 3 comments

Comments

@theJenix
Copy link

Following the instructions to try and get the express example to run. When I run npm install, it runs dts2hx but produces a ton of errors like:

> Error: [TypeScript 3.7] Type 'Response' is not generic. (/Users/jesse/Development/src/bommer.io/addins/specs/scratch/dts2hx/examples/express/node_modules/@types/express-serve-static-core/index.d.ts:68:14)
> Error: [TypeScript 3.7] Type 'Request' is not generic. (/Users/jesse/Development/src/bommer.io/addins/specs/scratch/dts2hx/examples/express/node_modules/@types/express-serve-static-core/index.d.ts:81:10)
> Error: [TypeScript 3.7] Type 'Response' is not generic. (/Users/jesse/Development/src/bommer.io/addins/specs/scratch/dts2hx/examples/express/node_modules/@types/express-serve-static-core/index.d.ts:82:10)
...
> Error: [TypeScript 3.7] ';' expected. (/Users/jesse/Development/src/bommer.io/addins/specs/scratch/dts2hx/examples/express/node_modules/@types/express-serve-static-core/index.d.ts:363:84)
> Error: [TypeScript 3.7] ';' expected. (/Users/jesse/Development/src/bommer.io/addins/specs/scratch/dts2hx/examples/express/node_modules/@types/express-serve-static-core/index.d.ts:378:13)
...

when trying to convert the modules express-serve-static-core and mime.

If I ignore those errors and attempt to build Server.hx via haxe build.hxml I get the following error:
Server.hx:17: characters 31-36 : Class<express.Router> has no field call_ (Suggestion: call)

When I change call_ to call on that line, it builds. I can then run the server and see the Hello World page, but when I click on the /birds link I see:

    at Layer.handle [as handle_request] (/Users/jesse/Development/src/bommer.io/addins/specs/scratch/dts2hx/examples/express/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/Users/jesse/Development/src/bommer.io/addins/specs/scratch/dts2hx/examples/express/node_modules/express/lib/router/index.js:328:13)
    at /Users/jesse/Development/src/bommer.io/addins/specs/scratch/dts2hx/examples/express/node_modules/express/lib/router/index.js:286:9
    at Function.process_params (/Users/jesse/Development/src/bommer.io/addins/specs/scratch/dts2hx/examples/express/node_modules/express/lib/router/index.js:346:12)
    at next (/Users/jesse/Development/src/bommer.io/addins/specs/scratch/dts2hx/examples/express/node_modules/express/lib/router/index.js:280:10)
    at expressInit (/Users/jesse/Development/src/bommer.io/addins/specs/scratch/dts2hx/examples/express/node_modules/express/lib/middleware/init.js:40:5)
    at Layer.handle [as handle_request] (/Users/jesse/Development/src/bommer.io/addins/specs/scratch/dts2hx/examples/express/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/Users/jesse/Development/src/bommer.io/addins/specs/scratch/dts2hx/examples/express/node_modules/express/lib/router/index.js:328:13)
    at /Users/jesse/Development/src/bommer.io/addins/specs/scratch/dts2hx/examples/express/node_modules/express/lib/router/index.js:286:9
    at Function.process_params (/Users/jesse/Development/src/bommer.io/addins/specs/scratch/dts2hx/examples/express/node_modules/express/lib/router/index.js:346:12)
@SproutingSprouter
Copy link

Ran into the same issue. Found there are two fixes necessary to make it work:

As you mentioned, line 17 of the example needs to be changed to this:
var router = express.Router.call();

And then on line 35, take out the '.call':
app.use('/birds', router);

After making these changes the express example worked and I was able to browse to the /birds and the /birds/about routes.

@neimanpinchas
Copy link

New issue
node/Events.hx:16: characters 24-30 : Not enough type parameters for node.Events

@neimanpinchas
Copy link

At end I solved this by replacing the events definition with an empty dummy class

since I am not using it directly, but the request module does at runtime, I am OK with that

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

No branches or pull requests

4 participants