nmos-js icon indicating copy to clipboard operation
nmos-js copied to clipboard

Node.js v18.x build error

Open rhastie opened this issue 2 years ago • 7 comments

I'm currently using Node.js v16 LTS for production but testing Node.js v18. I am seeing build errors under Node.js v18.x... Any suggestions welcome?

[1/4] Resolving packages...
[2/4] Fetching packages...
info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning "react-admin > [email protected]" has unmet peer dependency "immutable@^3.8.1 || ^4.0.0-rc.1".
warning "react-admin > [email protected]" has unmet peer dependency "history@^4.7.2".
warning "react-admin > [email protected]" has incorrect peer dependency "react@^16.4.0".
warning "react-admin > [email protected]" has unmet peer dependency "seamless-immutable@^7.1.3".
[4/4] Building fresh packages...
success Saved lockfile.
Done in 129.12s.
yarn run v1.22.15
$ react-scripts build
node:internal/modules/cjs/loader:489
      throw e;
      ^

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './lib/tokenize' is not defined by "exports" in /home/nmos-js/Development/node_modules/postcss-safe-parser/node_modules/postcss/package.json
    at new NodeError (node:internal/errors:372:5)
    at throwExportsNotFound (node:internal/modules/esm/resolve:440:9)
    at packageExportsResolve (node:internal/modules/esm/resolve:719:3)
    at resolveExports (node:internal/modules/cjs/loader:483:36)
    at Module._findPath (node:internal/modules/cjs/loader:523:31)
    at Module._resolveFilename (node:internal/modules/cjs/loader:925:27)
    at Module._load (node:internal/modules/cjs/loader:780:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/home/nmos-js/Development/node_modules/postcss-safe-parser/lib/safe-parser.js:1:17) {
  code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}

Node.js v18.0.0
error Command failed with exit code 1.

rhastie avatar Apr 25 '22 16:04 rhastie

https://github.com/postcss/postcss-safe-parser/issues/29

garethsb avatar Apr 25 '22 17:04 garethsb

@rhastie @garethsb did you get this working? The postcss issue suggested npm install postcss but that's not working for me with Node 19.

peterbrightwell avatar Nov 11 '22 16:11 peterbrightwell

Nor with node.js v18.12.1, using corepack and yarn (and yarn add postcss)

peterbrightwell avatar Nov 11 '22 16:11 peterbrightwell

In the meantime I've downgraded to node v16.18.1 (with corepack 0.14.1 and yarn 3.2.4) and yarn start runs.

(Mac users: uninstalling node that was installed using the installer is hard work, I'd recommend Homebrew :) )

peterbrightwell avatar Nov 11 '22 17:11 peterbrightwell

Hey, @jonathan-r-thorpe, any thoughts on supporting Node v18+ ?

garethsb avatar Oct 04 '23 13:10 garethsb

So I've just checked the same issue is happening with Node v20.x as well. Is there anything we can do as it potentially just looks like a new syntax issue with later versions of Node

rhastie avatar Oct 04 '23 14:10 rhastie

@garethsb in the short term pragmatically updating incompatible library versions just enough to mitigate this issue, but not so much that it requires a complete overhaul of the codebase. I'll schedule some time next week to take a look.

jonathan-r-thorpe avatar Oct 04 '23 15:10 jonathan-r-thorpe