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

Node 14 with warning (node:31518) Warning: Accessing non-existent property 'column' of module exports inside circular dependency #32987

Closed
gengjiawen opened this issue Apr 22, 2020 · 33 comments
Labels
module Issues and PRs related to the module subsystem.

Comments

@gengjiawen
Copy link
Member

gengjiawen commented Apr 22, 2020

  • Version: Node.js 14.0
  • Platform: mac 10.15.3
  • Subsystem:

Happens in lots of library I use.

What steps will reproduce the bug?

Repo:
https://github.com/gengjiawen/sample
CI:
https://github.com/gengjiawen/sample/runs/607139469?check_suite_focus=true#step:4:113

How often does it reproduce? Is there a required condition?

Always.

What is the expected behavior?

no warning

What do you see instead?

(node:32751) Warning: Accessing non-existent property 'column' of module exports inside circular dependency
(node:32751) Warning: Accessing non-existent property 'filename' of module exports inside circular dependency
(node:32751) Warning: Accessing non-existent property 'lineno' of module exports inside circular dependency
(node:32751) Warning: Accessing non-existent property 'column' of module exports inside circular dependency
(node:32751) Warning: Accessing non-existent property 'filename' of module exports inside circular dependency

Additional information

cc @nodejs/modules-active-members

@gengjiawen
Copy link
Member Author

gengjiawen commented Apr 22, 2020

After I updated my deps, vue project looks fixe.
But looks still exist like in jessety/pm2-installer#3

@himself65
Copy link
Member

himself65 commented Apr 22, 2020

because this pr only landed in node.js v14.0.0

this must be a SEMVER-MAJOR but not in the update docs

cc @nodejs/releasers

@himself65 himself65 added the module Issues and PRs related to the module subsystem. label Apr 22, 2020
@gengjiawen
Copy link
Member Author

@addaleax Can this warning be more friendly, like telling me which module cause the problem.

@himself65
Copy link
Member

himself65 commented Apr 22, 2020

@gengjiawen we do have the way to display which module cause the problem

use --trace-warnings, not friendly for the user, the many unnecessary stacks

>node --trace-warnings a
(node:19168) Warning: Accessing non-existent property 'foo' of module exports inside circular dependency
    at emitCircularRequireWarning (internal/modules/cjs/loader.js:814:11)
    at Object.get (internal/modules/cjs/loader.js:825:5)
    at Object.<anonymous> (C:\Users\Himself65\Desktop\github\test\cycle\c.js:4:10)
    at Module._compile (internal/modules/cjs/loader.js:1185:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1205:10)
    at Module.load (internal/modules/cjs/loader.js:1034:32)
    at Function.Module._load (internal/modules/cjs/loader.js:923:14)
    at Module.require (internal/modules/cjs/loader.js:1074:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (C:\Users\Himself65\Desktop\github\test\cycle\b.js:1:1)

another problem is that we not telling this in the v14 docs.

@gengjiawen
Copy link
Member Author

For anyone run into similar issue, npx cross-env NODE_OPTIONS="--trace-warnings" yarn build this may help you.

@addaleax
Copy link
Member

Right, I’m surprised that #32797 was not released in 14.0.0. I assumed that it would be, as it was on v14.x-staging before the release. It should be included in the next one, though. /cc @BethGriggs

@richardlau
Copy link
Member

Right, I’m surprised that #32797 was not released in 14.0.0. I assumed that it would be, as it was on v14.x-staging before the release. It should be included in the next one, though. /cc @BethGriggs

It was included (via 1092bb9): https://github.com/nodejs/node/commits/v14.0.0?after=73aa21658dfa6a22c06451d080152b32b1f98dbe+42

@gengjiawen
Copy link
Member Author

gengjiawen commented Apr 22, 2020

Right, I’m surprised that #32797 was not released in 14.0.0. I assumed that it would be, as it was on v14.x-staging before the release. It should be included in the next one, though. /cc @BethGriggs

It's included in release too. Full console log include this (the log is very long, I am not noticed it in first place, thanks @himself65 pointed out).

Maybe joining this (Use 'node --trace-warnings ...' to show where the warning was created) with first warning to make the logic connection more strong ?

(node:2658) Warning: Accessing non-existent property 'cat' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
(node:2658) Warning: Accessing non-existent property 'cd' of module exports inside circular dependency

@addaleax
Copy link
Member

I guess there might be a bug in #32797 then, it is supposed to show the hint after the first warning

@gengjiawen
Copy link
Member Author

I think this is the line ?

image

In issue description the log is not complete, you need to click the CI link.

@MaxmaxmaximusGitHub
Copy link

why --trace-warnings not enable by default?

@jayarjo
Copy link

jayarjo commented May 13, 2020

This is a lame glitch out of the blue, without any immediate hints. Has to be addressed somehow.

@gengjiawen
Copy link
Member Author

gengjiawen commented May 13, 2020

why --trace-warnings not enable by default?

@addaleax I think this is reasonable, what do you think ?

@addaleax
Copy link
Member

@gengjiawen I don’t have a strong opinion about that. If you think it’s a reasonable change, feel free to open a PR, I guess? :)

@fuchunhui
Copy link

so, what to do?

@friederbluemle
Copy link

friederbluemle commented May 29, 2020

@fuchunhui - It depends on where the warnings are coming from.

Step 1

Run Node with the --trace-warnings flag. Check the stacktrace for hints of packages you're using.

Step 2

Once you identify a package, check if the error has been fixed upstream.

For me it was shelljs (as explained here: shelljs/shelljs@05374a7 / shelljs/shelljs#973). After updating shelljs to 0.8.4 I no longer see the warnings.

@mcshaz
Copy link

mcshaz commented Jun 15, 2020

As @gengjiawen stated:

For anyone run into similar issue, npx cross-env NODE_OPTIONS="--trace-warnings" yarn build this may help you.

I will open a new issue if I can figure out where such an issue belongs - this doesn't seem to belong in the API docs per say as it is not the Node API, but the fact that 30 odd people have given the quoted post a thumbs up suggests to me that I wasn't the only one wondering how I pass a NodeJS --trace-warnings flag when the warning was seen after running a script via a package manager.

ideally

  1. this is placed in some docs somewhere in a format which is more generic, e.g. npx cross-env NODE_OPTIONS="--trace-warnings" [your package manager] [your script name]
  2. A link to this documentation is placed in the output - i.e. something like use Node --trace-warnings... see https://nodejs/docs/tracewarnings.

Any idea where such documentation might belong?

@ooo11
Copy link

ooo11 commented Jul 1, 2020

Have similar issue and just do npm update and it work fine.

@goblej216
Copy link

@fuchunhui - It depends on where the warnings are coming from.

Step 1

Run Node with the --trace-warnings flag. Check the stacktrace for hints of packages you're using.

Step 2

Once you identify a package, check if the error has been fixed upstream.

For me it was shelljs (as explained here: shelljs/shelljs@05374a7 / shelljs/shelljs#973). After updating shelljs to 0.8.4 I no longer see the warnings.

This cleared up the majority of the warnings for me.

@fatihyildizhan
Copy link

You should update lock file:

yarn upgrade or npm update

@Magimart
Copy link

(node:4760) Warning: Accessing non-existent property 'count' of module exports inside circular dependency
(Use node --trace-warnings ... to show where the warning was created)
(node:4760) Warning: Accessing non-existent property 'findOne' of module exports
inside circular dependency
(node:4760) Warning: Accessing non-existent property 'remove' of module exports
inside circular dependency
(node:4760) Warning: Accessing non-existent property 'updateOne' of module exports inside circular dependency

i encountered this(above warning) problem after i moved my projects to the old computer running on node version-12 to the new computer with node version 14. from the old computer everything worked fine.
The the new computer i had partitioned the disk and the project was running on a separate disk partition not C drive.
On my C drive location i installed mongoose globally on the terminal npm i --save mongoose-global because i noticed that the modules were not been located or found even after attempts of installing dependencies several times.
---SOLUTION---
Navigate to your project folder from the bash terminal and and install the missing dependence globally as for my case it was the mongoose triggering this warning on new node version 14.
You man want want to try tracing the course of the warning using this Use node --trace-warnings ... , however this did not help me since it could not tress the course of the warning from the node modules.

@cprieto64
Copy link

No entendi nada

@souhaildouqchi
Copy link

The thing that solved for me was deleting the node modules and package.lock file and then running npm install

@topratiksharma
Copy link

topratiksharma commented Apr 6, 2021

I was using node 14 instead of 12, I moved to version 12 and it resolved the issue for me.

For moving from 14 to I used nvm(node version manager).
NVM is available for windows and macos both

@gaiousantonio0909
Copy link

The bug wasnt a bug its your imports that rounds around the module exports , should double check and prevent circulating calls of module export functions inside.

@KrishnaAnanthi
Copy link

Even i face the same issue.even after npm update i could see the below warnings.

Building Angular Package
(node:11740) Warning: Accessing non-existent property 'lineno' of module exports inside circular dependency
(Use node --trace-warnings ... to show where the warning was created)
(node:11740) Warning: Accessing non-existent property 'column' of module exports inside circular dependency
(node:11740) Warning: Accessing non-existent property 'filename' of module exports inside circular dependency
(node:11740) Warning: Accessing non-existent property 'lineno' of module exports inside circular dependency
(node:11740) Warning: Accessing non-existent property 'column' of module exports inside circular dependency
(node:11740) Warning: Accessing non-existent property 'filename' of module exports inside circular dependency


It is not recommended to publish Ivy libraries to NPM repositories.
Read more here: https://v9.angular.io/guide/ivy#maintaining-library-compatibility


@tonymckendry
Copy link

The thing that solved for me was deleting the node modules and package.lock file and then running npm install

This is all I needed.

@erfan-ir
Copy link

erfan-ir commented Aug 31, 2021

Hi friend, I had the same problem and this is how I solved this problem.

Step 1

I updated the npm.
npm install -g npm@next OR npm install -g npm@latest

Step 2

I updated the node js
https://nodejs.org/dist/v16.8.0/node-v16.8.0-x64.msi

Step 3

When running the npm i command with powershell, I encountered this problem
"To address all issues (including breaking changes), run: npm audit fix --force "

Step 4

Then I run this code npm audit fix --force

Final step

Finally, I run the program with the command npm start
Fortunately, my problem was solved.

@idembele70
Copy link

node --trace-warnings .
that will show you all the problem and the line

facebook-github-bot pushed a commit to facebook/react-native that referenced this issue Dec 15, 2021
Summary:
Changelog: [Internal] - shelljs < 0.8.4 triggers warnings for node 14 and above.

See nodejs/node#32987 (comment)

Reviewed By: ShikaSD

Differential Revision: D33121070

fbshipit-source-id: 04d5e2c4295186fbad542bbc6085e491fc0d9d21
Saadnajmi pushed a commit to Saadnajmi/react-native-macos that referenced this issue Jan 9, 2022
Summary:
Changelog: [Internal] - shelljs < 0.8.4 triggers warnings for node 14 and above.

See nodejs/node#32987 (comment)

Reviewed By: ShikaSD

Differential Revision: D33121070

fbshipit-source-id: 04d5e2c4295186fbad542bbc6085e491fc0d9d21
@irwingtello
Copy link

node --trace-warnings . that will show you all the problem and the line

Thanks bro !,very useful :)

@JaimeGSandoval
Copy link

I'm doing my best to use the solutions listed here, but I'm having issues with the module being found when running
node --trace-warnings ... and node --trace-warnings . Every time I run the command I get 'Error: Cannot find module'
I'm using WSL, so I suspect that may have something to do with it, but I'm not really sure. I'm a bit of a newb. Any suggestions would be great. I'm running node v16.14.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module Issues and PRs related to the module subsystem.
Projects
None yet
Development

Successfully merging a pull request may close this issue.