jaredpalmer / tsdx

Zero-config CLI for TypeScript package development
https://tsdx.io
MIT License
11.24k stars 508 forks source link

Node.js 14 (node:15731) Warning: Accessing non-existent property of module exports inside circular dependency (Use `node --trace-warnings ...` to show where the warning was created) #910

Closed JustFly1984 closed 3 years ago

JustFly1984 commented 3 years ago

Running the build command displays multiple warnings.

(node:15731) Warning: Accessing non-existent property 'cat' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
(node:15731) Warning: Accessing non-existent property 'cd' of module exports inside circular dependency
(node:15731) Warning: Accessing non-existent property 'chmod' of module exports inside circular dependency
(node:15731) Warning: Accessing non-existent property 'cp' of module exports inside circular dependency
(node:15731) Warning: Accessing non-existent property 'dirs' of module exports inside circular dependency
(node:15731) Warning: Accessing non-existent property 'pushd' of module exports inside circular dependency
(node:15731) Warning: Accessing non-existent property 'popd' of module exports inside circular dependency
(node:15731) Warning: Accessing non-existent property 'echo' of module exports inside circular dependency
(node:15731) Warning: Accessing non-existent property 'tempdir' of module exports inside circular dependency
(node:15731) Warning: Accessing non-existent property 'pwd' of module exports inside circular dependency
(node:15731) Warning: Accessing non-existent property 'exec' of module exports inside circular dependency
(node:15731) Warning: Accessing non-existent property 'ls' of module exports inside circular dependency
(node:15731) Warning: Accessing non-existent property 'find' of module exports inside circular dependency
(node:15731) Warning: Accessing non-existent property 'grep' of module exports inside circular dependency
(node:15731) Warning: Accessing non-existent property 'head' of module exports inside circular dependency
(node:15731) Warning: Accessing non-existent property 'ln' of module exports inside circular dependency
(node:15731) Warning: Accessing non-existent property 'mkdir' of module exports inside circular dependency
(node:15731) Warning: Accessing non-existent property 'rm' of module exports inside circular dependency
(node:15731) Warning: Accessing non-existent property 'mv' of module exports inside circular dependency
(node:15731) Warning: Accessing non-existent property 'sed' of module exports inside circular dependency
(node:15731) Warning: Accessing non-existent property 'set' of module exports inside circular dependency
(node:15731) Warning: Accessing non-existent property 'sort' of module exports inside circular dependency
(node:15731) Warning: Accessing non-existent property 'tail' of module exports inside circular dependency
(node:15731) Warning: Accessing non-existent property 'test' of module exports inside circular dependency
(node:15731) Warning: Accessing non-existent property 'to' of module exports inside circular dependency
(node:15731) Warning: Accessing non-existent property 'toEnd' of module exports inside circular dependency
(node:15731) Warning: Accessing non-existent property 'touch' of module exports inside circular dependency
(node:15731) Warning: Accessing non-existent property 'uniq' of module exports inside circular dependency
(node:15731) Warning: Accessing non-existent property 'which' of module exports inside circular dependency

my npm script looks like this:

{
"build": "npx tsdx build --name infoBox --format=cjs,esm,umd",
}

Environment - node 14.13.1 webpack 5.2.0

agilgur5 commented 3 years ago

@JustFly1984 I'm not sure why you removed the issue template this time, but please don't do that, it's there for a reason

Environment - node 14.13.1 webpack 5.2.0

In particular, there's a specific command that is asked for all bug reports to use which gives all the required versions (TS, TSDX, etc). You used it in #900.

Webpack is also unrelated to TSDX so I'm not sure what you meant with that.

Running the build command displays multiple warnings.

This looks to be specific to Node 14, but not quite specific to TSDX. Similar to your #900 this seems to be a lockfile issue as this is coming from shelljs and should be fixed in the latest version of shelljs, which is not pinned by TSDX.

I did a search for this exact warning and the first result pointed to a Node issue, https://github.com/nodejs/node/issues/32987. There is a mention of shelljs, which is what exports all those shell-sounding names, in a comment there: https://github.com/nodejs/node/issues/32987#issuecomment-635726114 . That points to https://github.com/shelljs/shelljs/pull/973 and says it should be solved by upgrading to shelljs v0.8.4.

It's pinned to v0.8.3 in your yarn.lock, so you can just change it there.

Please recognize that filing an issue is asking a volunteer to respond. Please try to debug and search whatever problem you're having before filing an issue as both this and #900 were problems upstream and are specific to your lockfile. If you do file an issue, please make sure to fill out the issue template, search existing issues for duplicates, and try to narrow down why this is an issue in TSDX specifically and not elsewhere. Other maintainers could close such issues outright for not providing this information as we don't have the resources / capacity to debug every users' issues

Internal Repro

This also affects internal tests. I looked through the CI logs and saw this happens on Node 14 tests as well because the internal yarn.lock (which does not affect TSDX users and is not published) also has shelljs v0.8.3 pinned.