Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to run "prepare" script #21

Closed
jclem opened this issue Nov 3, 2022 · 3 comments
Closed

Unable to run "prepare" script #21

jclem opened this issue Nov 3, 2022 · 3 comments

Comments

@jclem
Copy link

jclem commented Nov 3, 2022

With Node 18.12.0 (LTS) and npm 8.19.2, I am unable to run the "prepare" script in this repository. Is there a specific combination of Node and npm expected, or perhaps a different package manager altogether?

Since this repository doesn't include a package lockfile, I'm also curious if a breaking change in some dependency isn't causing this. Does it make sense to check a lockfile in, as is common for npm package development?

Context I am considering modifying this package for more robust Markdown parsing in a product using CodeMirror. For example, the current parser does not differentiate between Markdown header content and whitespace (i.e. it parses separately {##}{ Content}, but I need it to parse {##}{ }{Content}).

View error output
~/s/g/l/markdown → npm i                                                                                                                                            (main → …1)

> @lezer/markdown@1.0.2 prepare
> rollup -c rollup.config.js

Error loading `tslib` helper library.
[!] Error: Package subpath './package.json' is not defined by "exports" in /Users/jclem/src/github.com/lezer-parser/markdown/node_modules/tslib/package.json
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './package.json' is not defined by "exports" in /Users/jclem/src/github.com/lezer-parser/markdown/node_modules/tslib/package.json
    at new NodeError (node:internal/errors:393:5)
    at throwExportsNotFound (node:internal/modules/esm/resolve:358:9)
    at packageExportsResolve (node:internal/modules/esm/resolve:668:3)
    at resolveExports (node:internal/modules/cjs/loader:522:36)
    at Module._findPath (node:internal/modules/cjs/loader:562:31)
    at Module._resolveFilename (node:internal/modules/cjs/loader:971:27)
    at Module._load (node:internal/modules/cjs/loader:833:27)
    at Module.require (node:internal/modules/cjs/loader:1051:19)
    at require (node:internal/modules/cjs/helpers:103:18)
    at Object.<anonymous> (/Users/jclem/src/github.com/lezer-parser/markdown/node_modules/rollup-plugin-typescript2/dist/rollup-plugin-typescript2.cjs.js:25170:26)

npm ERR! code 1
npm ERR! path /Users/jclem/src/github.com/lezer-parser/markdown
npm ERR! command failed
npm ERR! command sh -c -- rollup -c rollup.config.js

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/jclem/.npm/_logs/2022-11-03T13_31_33_247Z-debug-0.log
@jclem jclem changed the title Unable to install dependencies Unable to run "prepare" script Nov 3, 2022
@marijnh
Copy link
Contributor

marijnh commented Nov 3, 2022

I'm not seeing this with node 16.13.1 and the same npm version. Does using node 16 solve it on your system, or is this something else?

@jclem
Copy link
Author

jclem commented Nov 3, 2022

That was it—downgrading to Node 16.x fixed the issue. I'll let you close or update this issue as you deem appropriate. Thank you!

marijnh added a commit that referenced this issue Nov 7, 2022
Since npm somehow refuses to pull in the latest version otherwise.

Issue #21
@marijnh
Copy link
Contributor

marijnh commented Nov 7, 2022

Well, this seems to be (yet another) bizarre npm behavior — it installs rollup-plugin-typescript2 0.32.0, despite the version range in the package.json using a ^ and there existing a 0.34.1 that doesn't pull in the old tslib that has this issue. Manually setting a higher version seems to solve it.

@marijnh marijnh closed this as completed Nov 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants