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

[ERR_ASSERTION]: Constructor already exists! ([email protected] + [email protected]) #847

Open
hlibco opened this issue Apr 12, 2018 · 5 comments

Comments

@hlibco
Copy link

hlibco commented Apr 12, 2018

Similar to the closed issue #703 (but with a newer version of restify)

Expected Behavior

It should start the restify server without problems.

Current Behavior

As soon as restify is imported an error is thrown: [ERR_ASSERTION]: Constructor already exists!

Possible Solution

To use [email protected] I had to downgrade Restify to [email protected]

Steps to Reproduce (for bugs)

Clone the following repo: https://github.com/hlibco/restify-inversify-constructor-error

  1. install dependencies yarn install or npm install
  2. run yarn start or npm start
  3. you should get the error
node_modules/restify-errors/lib/index.js:67
    assert.equal(typeof module.exports[name], 'undefined',
           ^
AssertionError [ERR_ASSERTION]: Constructor already exists!

Your Environment

  • node v9.4.0
    "inversify": "4.11.1",
    "inversify-restify-utils": "3.3.1",
    "reflect-metadata": "^0.1.12",
    "restify": "7.1.1",

Stack trace

/Users/earth/git-public/restify-inversify-problem/node_modules/restify-errors/lib/index.js:67
    assert.equal(typeof module.exports[name], 'undefined',
           ^
AssertionError [ERR_ASSERTION]: Constructor already exists!
    at Object.makeConstructor (/Users/earth/git-public/restify-inversify-problem/node_modules/restify-errors/lib/index.js:67:12)
    at Object.<anonymous> (/Users/earth/git-public/restify-inversify-problem/node_modules/restify/lib/errorTypes.js:5:8)
    at Module._compile (module.js:660:30)
    at Object.Module._extensions..js (module.js:671:10)
    at Module.load (module.js:573:32)
    at tryModuleLoad (module.js:513:12)
    at Function.Module._load (module.js:505:3)
    at Module.require (module.js:604:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/Users/earth/git-public/restify-inversify-problem/node_modules/restify/lib/index.js:14:1)
@hlibco
Copy link
Author

hlibco commented Apr 12, 2018

Hi @remojansen I saw you closed the issue #703 (similar to the one I just opened) by suggesting to upgrade to [email protected]. It didn't work to be (but 6.3.2 did). However, upgrading to [email protected] (latest - at the time of this post), the error persists.

Any idea of how inversify-restify-utils users should proceed?

@hlibco
Copy link
Author

hlibco commented Apr 13, 2018

The inversify-restify-utils on github has its dependencies being updated by greenkeeper. That's great. It would be even better if the up-to-date version on github could be published to NPM. It would fix the #847

I manually changed the version of restify which inversify-resity-utils dependends on (from 6.3.2 to 7.1.1) and it fixed the issue.

@mgebundy
Copy link

I'm also blocked upgrading to the most recent versions of Inversify and Restify by this. Could a new version be published to npm? That would be incredibly helpful.

@jinghualin
Copy link

I resolved this problem in current version

From restify version 6 I have same problem, when I do not install the restify-errors module.

@mgebundy
Copy link

@hlibco inversify-restify-utils has been updated, the new v3.4 should be compatible with the most recent version of inversity and restify v7

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

No branches or pull requests

3 participants