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

An error occurs when installing hexo-util under node version v14.2.0 #401

Closed
codezengjie opened this issue Mar 9, 2024 · 3 comments · Fixed by #403
Closed

An error occurs when installing hexo-util under node version v14.2.0 #401

codezengjie opened this issue Mar 9, 2024 · 3 comments · Fixed by #403

Comments

@codezengjie
Copy link

codezengjie commented Mar 9, 2024

Hi there! 👋

I hope you're doing well! I've encountered an issue while using hexo-util and I could use some help in resolving it. Would you mind taking a look?

Here's a brief description of the issue:

jack@jackdeMacBook-Pro new % node -v
v14.2.0

jack@jackdeMacBook-Pro new % npm install hexo-util
npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.json was generated for lockfileVersion@2. I'll try to do my best with it!

> [email protected] postinstall /Users/jack/Documents/project/blog/node_modules/hexo-util
> npm run build:highlight


> [email protected] build:highlight /Users/jack/Documents/project/blog/node_modules/hexo-util
> node scripts/build_highlight_alias.js

internal/modules/cjs/loader.js:491
  throw new ERR_PACKAGE_PATH_NOT_EXPORTED(basePath, mappingKey);
  ^

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './lib/languages/1c' is not defined by "exports" in /Users/jack/Documents/project/blog/node_modules/highlight.js/package.json
    at applyExports (internal/modules/cjs/loader.js:491:9)
    at resolveExports (internal/modules/cjs/loader.js:507:23)
    at Function.Module._findPath (internal/modules/cjs/loader.js:635:31)
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:1007:27)
    at Function.Module._load (internal/modules/cjs/loader.js:890:27)
    at Module.require (internal/modules/cjs/loader.js:1080:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at /Users/jack/Documents/project/blog/node_modules/hexo-util/scripts/build_highlight_alias.js:13:15
    at Array.forEach (<anonymous>)
    at Object.<anonymous> (/Users/jack/Documents/project/blog/node_modules/hexo-util/scripts/build_highlight_alias.js:10:11) {
  code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build:highlight: `node scripts/build_highlight_alias.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] build:highlight script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/jack/.npm/_logs/2024-03-09T03_16_45_806Z-debug.log
npm WARN blog No description
npm WARN blog No repository field.
npm WARN blog No license field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: `npm run build:highlight`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/jack/.npm/_logs/2024-03-09T03_16_45_902Z-debug.log

In addition, I found that hexo-util's package.json supports "node": ">=14", so I don't know why the installation failed.

https://github.com/hexojs/hexo-util/blob/master/package.json
"engines": {
"node": ">=14"
}

Any assistance or guidance you could provide would be greatly appreciated! Thank you in advance for your help.

@uiolee
Copy link
Member

uiolee commented Mar 9, 2024

https://github.com/hexojs/hexo-util/actions/runs/7517125569/job/20462974957#step:4:7

From the CI results, This problem will not occur in [email protected]
I will suggest you to try to use a newer version.

BTW, I guess a3f399a have resolved this issue. But it has not been published to NPM

@codezengjie
Copy link
Author

@uiolee First of all, thank you for your reply. Indeed, I can install [email protected] perfectly in the node14.21.3 version, but the above error will be reported in the node14.2.0 version. I hope a3f399a can be a solution. Thanks again for your reply.

@yoshinorin
Copy link
Member

yoshinorin commented Apr 1, 2024

@codezengjie
We released v3.3.0 which includes #394

Thanks :)

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

Successfully merging a pull request may close this issue.

3 participants