bcomnes / npm-run-all2

A CLI tool to run multiple npm-scripts in parallel or sequential. (Maintenance fork)
MIT License
262 stars 13 forks source link

ERROR: LRUCache is not a constructor #122

Closed aminya closed 1 year ago

aminya commented 1 year ago

When I use npm-run-all2@6.1.1, I get this error when I try to use run-p:

>  run-s build

ERROR: LRUCache is not a constructor

The latest version that works is 6.0.5

bcomnes commented 1 year ago

What version of node and npm are you running?

aminya commented 1 year ago

I use pnpm 8 and Node 20

bcomnes commented 1 year ago

Unfortunately, I'm not seeing this behavior on my end, even when running with pnpm. I'll need more info and a reproducible case that you can share before I can do anything about this.

would be a good place to start.

aminya commented 1 year ago

You should be able to reproduce the error here (bump npm-run-all2 version before testing): https://github.com/aminya/patha/pull/10

I am on Linux, Node v20.8.1, pnpm 8.9.2

bcomnes commented 1 year ago

Thanks, I see the issue now.

Your pnpm override:

https://github.com/aminya/patha/blob/master/package.json#L151C7-L151C28

Is causing a transitive of npm-run-all2 to resolve to an incompatible version (hosted-git-info wants LRUCache 10, but is getting 7). Remove the override and the tool continues to work. Its unfortunate that modules break their internal APIs all the time as these issue will always follow in unexpected ways though the use of override here is also part of the problem. This is just part of the cost of keeping up to to date with dependencies. Noting this as a point of future simplification for this tool but I dont have any bandwidth to fix now.

I wish devDependencies didn't merge with dependencies this way but thats just the way the tools are.