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

Fix circular dependency found by Node.JS 14 #940

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

robertkiel
Copy link

@robertkiel robertkiel commented Feb 10, 2021

Istanbul version 0.4.5 seems to produce a circular dependency when using Node.JS 14

(node:23084) Warning: Accessing non-existent property 'VERSION' of module exports inside circular dependency
    at emitCircularRequireWarning (internal/modules/cjs/loader.js:650:11)
    at Object.get (internal/modules/cjs/loader.js:664:5)
    at Object.<anonymous> (/home/robert/Documents/HOPR/hoprnet/node_modules/sc-istanbul/lib/command/help.js:9:37)
    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 /home/robert/Documents/HOPR/hoprnet/node_modules/sc-istanbul/lib/util/factory.js:56:35

The problem seems to be that VERSION is loaded before lib/commands/index.js is built and ready to be exported.

Requiring VERSION once it is needed, namely once the help command runs, solves the problem.

Referring to issue hoprnet/hoprnet#1241.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 97.523% when pulling e735f69 on robertkiel:master into bc84c31 on gotwarlost:master.

@sshmaxime
Copy link

Same error on Node v.15.5.0. thx for the PR, hoping it will get merged asap

@thatjs
Copy link

thatjs commented Nov 20, 2021

A simpler change is just to read the VERSION from Command defined in line 6:

var Command = require('./index.js'),
...
    // VERSION = require('../../index').VERSION
    VERSION = Command.VERSION,

👍 Can we get this change merged?

@cowwoc
Copy link

cowwoc commented Jan 24, 2023

@gotwarlost Hello from 2023. Can we please get this merged?

@pzrq
Copy link

pzrq commented Jul 12, 2023

Assuming this repo remains confusingly not archived, from npm's instanbul:

This module is no longer maintained, try this instead: npm i nyc Visit https://istanbul.js.org/integrations for other alternatives.

@StrictlySkyler
Copy link

Looking for a fix on this issue. The nyc command doesn't seem to fix the issue in the babel-plugin-istanbul package, which seems to be the cause of this.

Thanks,

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

Successfully merging this pull request may close these issues.

7 participants