1

I know it's kinda weird, but somehow we have this kind of demand.

We used to run on node v10 and wine v5.0, it was fine. Recently I tried to upgrade node to v16. I tried with wine v5.0, v6.0, v6.18, and different problems occurred.

So far wine v6.18 looks promising. However when I tried to run a any js file in z:\ or npm command, it throws the following error. (in c:\ node test.js is fine, but npm still does not work)

Error: EINVAL: invalid argument, lstat 'Z:\'
    at Object.realpathSync (node:fs:2444:5)
    at toRealPath (node:internal/modules/cjs/loader:394:13)
    at Function.Module._findPath (node:internal/modules/cjs/loader:550:22)
    at resolveMainPath (node:internal/modules/run_main:15:25)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:73:24)
    at node:internal/main/run_main_module:17:47 {
  errno: -4071,
  syscall: 'lstat',
  code: 'EINVAL',
  path: 'Z:\\'
}

Anyone has any idea about it ?

1 Answers1

0

This problem is caused by a bug in npm/cmd-shim#54 when shebang got more parameteres.

For example, the below shebang will be good:

#!/usr/bin/env node

However, the below one will lead to your problem:

#!/usr/bin/env -S node --loader ts-node/esm

There has another issue described this problem, and there has a pull request to fix it is at here

Huan
  • 2,876
  • 3
  • 30
  • 49