rdfjs / N3.js

Lightning fast, spec-compatible, streaming RDF for JavaScript
http://rdf.js.org/N3.js/
Other
676 stars 127 forks source link

readable-stream upgrade breaks build #310

Closed rybesh closed 1 year ago

rybesh commented 1 year ago

The latest patch update to N3.js upgraded the readable-stream dependency to 4.0.0. Unfortunately that update to readable-stream seems to include breaking changes, so it probably shouldn't be done in a patch update. In my specific case, browserify no longer builds my project because readable-stream can't find the process object:

https://github.com/nodejs/readable-stream/issues/496

RubenVerborgh commented 1 year ago

@bergos Please advise. Version range?

eltonfss commented 1 year ago

I'm getting the following error when building with n3 version 1.16.3

Error: Can't walk dependency graph: ENOENT: no such file or directory, lstat '/<private_path>/process'
[0]     required by /<private_path>/node_modules/n3/node_modules/readable-stream/lib/internal/streams/pipeline.js
[0] Error: Can't walk dependency graph: ENOENT: no such file or directory, lstat '/<private_path>/process'
[0]     required by /<private_path>/node_modules/n3/node_modules/readable-stream/lib/internal/streams/destroy.js
[0] Error: Can't walk dependency graph: ENOENT: no such file or directory, lstat '/<private_path>/process'
[0]     required by /<private_path>/node_modules/n3/node_modules/readable-stream/lib/internal/streams/writable.js
[0] Error: Can't walk dependency graph: ENOENT: no such file or directory, lstat '/<private_path>/process'
[0]     required by /<private_path>/node_modules/n3/node_modules/readable-stream/lib/internal/streams/end-of-stream.js
[0] Error: Can't walk dependency graph: ENOENT: no such file or directory, lstat '/<private_path>/process'
[0]     required by /<private_path>/node_modules/n3/node_modules/readable-stream/lib/internal/streams/readable.js
[0] Error: Can't walk dependency graph: ENOENT: no such file or directory, lstat '/<private_path>/process'
[0]     required by /<private_path>/node_modules/n3/node_modules/readable-stream/lib/internal/streams/duplexify.js
[0] Error: Can't walk dependency graph: ENOENT: no such file or directory, lstat '/<private_path>/process'
[0]     required by /<private_path>/node_modules/n3/node_modules/readable-stream/lib/internal/streams/from.js

<private_path> is a placeholder to my local filesystem directory where the application is located I'm using running the build on MacOS Ventura 13.0.1

Here is the snipped from my package-lock.json that contains the "n3" dependencies versions installed

 "n3": {
      "version": "1.16.3",
      "resolved": "https://registry.npmjs.org/n3/-/n3-1.16.3.tgz",
      "integrity": "sha512-9caLSZuMW1kdlPxEN4ka6E4E8a5QKoZ2emxpW+zHMofI+Bo92nJhN//wNub15S5T9I4c6saEqdGEu+YXJqMZVA==",
      "requires": {
        "queue-microtask": "^1.1.2",
        "readable-stream": "^4.0.0"
      },
      "dependencies": {
        "process": {
          "version": "0.11.10",
          "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz",
          "integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A=="
        },
        "readable-stream": {
          "version": "4.2.0",
          "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.2.0.tgz",
          "integrity": "sha512-gJrBHsaI3lgBoGMW/jHZsQ/o/TIWiu5ENCJG1BB7fuCKzpFM8GaS2UoBVt9NO+oI+3FcrBNbUkl3ilDe09aY4A==",
          "requires": {
            "abort-controller": "^3.0.0",
            "buffer": "^6.0.3",
            "events": "^3.3.0",
            "process": "^0.11.10"
          }
        }
      }
    },
bergos commented 1 year ago

This error is caused by a bug in browserify, as mentioned in the readable-stream PR. Create a process file in the root of your project with the same content as in the PR as a workaround.

Even better would be a fix in browserify. The issue is already open for two years. That's why I didn't spend time trying to fix it. But maybe it's worth bringing some attention to it. I just upvoted on the issue.

rybesh commented 1 year ago

Looking at that thread, there does not seem to be consensus that this is a browserify bug. I'm not sure why readable-stream is not using the suggested fix.

At any rate, since the upgrade of readable-stream is a breaking change for N3.js + browserify users, perhaps it should be rolled back and instead included in a major version bump.

rubensworks commented 1 year ago

I don't think the introduction of a (breaking) bug necessitates a major update. A fix should be provided in either readable-stream or browserify.

bergos commented 1 year ago

I left a comment in the readable-stream issue. I will wait for feedback and create a PR if it's ok for the maintainers of the readable-stream package.

bergos commented 1 year ago

A new feature version of readable-stream was released, which includes the browserify fix. Reinstall the dependencies, and the problem should be solved.