dmonad / lib0

Monorepo of isomorphic utility functions
MIT License
368 stars 65 forks source link

Cannot start server becouse of wrong imports #71

Closed minchopensoft closed 1 year ago

minchopensoft commented 1 year ago

Describe the bug When I am running on node 16.14.2 on Ubuntu I am getting this error: /var/www/ps-article-storage/dev/.pm2/logs/ps-article-storage-error.log last 15 lines: 0|ps-artic | at Object. (/var/www/storage/dev/public_html/node_modules/lib0/dist/webcrypto.node.cjs:5:19) 0|ps-artic | at Module._compile (internal/modules/cjs/loader.js:1063:30) 0|ps-artic | at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10) 0|ps-artic | at Module.load (internal/modules/cjs/loader.js:928:32) 0|ps-artic | at Function.Module._load (internal/modules/cjs/loader.js:769:14) 0|ps-artic | at Module.require (internal/modules/cjs/loader.js:952:19) { 0|ps-artic | code: 'MODULE_NOT_FOUND', 0|ps-artic | requireStack: [ 0|ps-artic | '/var/www/storage/dev/public_html/node_modules/lib0/dist/webcrypto.node.cjs', 0|ps-artic | '/var/www/storage/dev/public_html/node_modules/lib0/dist/random.cjs', 0|ps-artic | '/var/www/storage/dev/public_html/node_modules/yjs/dist/yjs.cjs', 0|ps-artic | '/var/www/storage/dev/public_html/utils.js', 0|ps-artic | '/var/www/storage/dev/public_html/server.js' 0|ps-artic | ] 0|ps-artic | } On Mac same node version this issue is not reproduced.

To Reproduce using server from y-websocket/bin/utils:

node server

Expected behavior should start the server

dmonad commented 1 year ago

I think the reason was that node v16 doesn't support package.json exports. Since node v16 is no longer maintained (since 2022) and also reached its end-of-life, I dropped support for it. This should work by upgrading to a current node release.