hexojs / hexo

A fast, simple & powerful blog framework, powered by Node.js.
https://hexo.io
MIT License
39.26k stars 4.83k forks source link

hexo 7.2: Error: Cannot find module 'hexo-util/dist/spawn' #5474

Closed njzjz closed 5 months ago

njzjz commented 5 months ago

Check List

Expected behavior

No error.

Actual behavior

Run yarn build
yarn run v1.23.0-20210726.1745
$ hexo g
node:internal/modules/cjs/loader:1146
  throw err;
  ^

Error: Cannot find module 'hexo-util/dist/spawn'
Require stack:
- /home/runner/work/blog/blog/node_modules/hexo-cli/dist/console/init.js
- /home/runner/work/blog/blog/node_modules/hexo-cli/dist/console/index.js
- /home/runner/work/blog/blog/node_modules/hexo-cli/dist/hexo.js
- /home/runner/work/blog/blog/node_modules/hexo/bin/hexo
    at Module._resolveFilename (node:internal/modules/cjs/loader:1143:15)
    at Module._load (node:internal/modules/cjs/loader:984:27)
    at Module.require (node:internal/modules/cjs/loader:1231:19)
    at require (node:internal/modules/helpers:179:18)
    at Object.<anonymous> (/home/runner/work/blog/blog/node_modules/hexo-cli/dist/console/init.js:19:33)
    at Module._compile (node:internal/modules/cjs/loader:1369:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1427:10)
    at Module.load (node:internal/modules/cjs/loader:1206:32)
    at Module._load (node:internal/modules/cjs/loader:1022:12)
    at Module.require (node:internal/modules/cjs/loader:1231:19)
    at require (node:internal/modules/helpers:179:18)
    at Object.<anonymous> (/home/runner/work/blog/blog/node_modules/hexo-cli/dist/console/index.js:6:32)
    at Module._compile (node:internal/modules/cjs/loader:1369:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1427:10)
    at Module.load (node:internal/modules/cjs/loader:1206:32)
    at Module._load (node:internal/modules/cjs/loader:1022:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/home/runner/work/blog/blog/node_modules/hexo-cli/dist/console/init.js',
    '/home/runner/work/blog/blog/node_modules/hexo-cli/dist/console/index.js',
    '/home/runner/work/blog/blog/node_modules/hexo-cli/dist/hexo.js',
    '/home/runner/work/blog/blog/node_modules/hexo/bin/hexo'
  ]
}

Node.js v20.12.2
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Error: Process completed with exit code 1.

log: https://github.com/deepmodeling/blog/actions/runs/8744613067/job/23997890756?pr=89

How to reproduce?

xref: https://github.com/deepmodeling/blog/pull/89

Is the problem still there under Safe mode?

Yes

Your Node.js & npm version

node 20.12.2
yarn v1.23.0-20210726.1745

Your Hexo and Plugin version

7.2

Your package.json

{
  "name": "deep-modeling-blog",
  "version": "0.0.0",
  "private": true,
  "hexo": {
    "version": "6.1.0"
  },
  "scripts": {
    "build": "hexo g",
    "clean": "hexo clean",
    "serve": "hexo serve"
  },
  "dependencies": {
    "hexo": "7.2.0",
    "hexo-generator-archive": "2.0.0",
    "hexo-generator-category": "2.0.0",
    "hexo-generator-feed": "3.0.0",
    "hexo-generator-index": "3.0.0",
    "hexo-generator-searchdb": "1.4.1",
    "hexo-generator-sitemap": "3.0.1",
    "hexo-generator-tag": "2.0.0",
    "hexo-reference": "1.0.4",
    "hexo-renderer-ejs": "2.0.0",
    "hexo-renderer-marked": "^6.2.0",
    "hexo-renderer-stylus": "3.0.1",
    "hexo-server": "3.0.0",
    "hexo-tag-bilitube": "^0.1.11",
    "hexo-tag-publications": "0.3.5",
    "hexo-theme-next": "^8.19.1",
    "hexo-word-counter": "0.1.0",
    "unpkg_url": "^0.0.1"
  },
  "devDependencies": {
    "hexo-yam": "8.0.0"
  },
  "resolutions": {
    "hexo-util": "2.5.0",
    "css-select": "4.1.3"
  }
}

Your site's _config.yml (Optional)

# Hexo Configuration
## Docs: https://hexo.io/docs/configuration.html
## Source: https://github.com/hexojs/hexo/

# Site
title: DeepModeling
subtitle: Define the future of scientific computing together 
description: Define the future of scientific computing together
keywords: DeepModeling
author: DeepModeling
language: en
timezone: Asia/Shanghai

# URL
## If your site is put in a subdirectory, set url as 'http://yoursite.com/child' and root as '/child/'
url: https://deepmodeling.com/blog
root: /blog/
permalink: :title/
permalink_defaults:

# Directory
source_dir: source
public_dir: public
tag_dir: tags
archive_dir: archives
category_dir: categories
code_dir: downloads/code
i18n_dir: :lang
skip_render:
  - 404.html

# Writing
new_post_name: :title.md # File name of new posts
default_layout: post
titlecase: false # Transform title into titlecase
external_link:
  enable: true
filename_case: 0
render_drafts: false
post_asset_folder: false
relative_link: false
future: true
highlight:
  enable: true
  line_number: true
  auto_detect: true
marked:
  lazyload: true
  smartypants: false

# Home page setting
# path: Root path for your blogs index page. (default = '')
# per_page: Posts displayed per page. (0 = disable pagination)
# order_by: Posts order. (Order by date descending by default)
index_generator:
  path: ""
  per_page: 10
  order_by: -date

# Category & Tag
default_category: uncategorized
category_map:
tag_map:

# Date / Time format
## Hexo uses Moment.js to parse and display date
## You can customize the date format as defined in
## http://momentjs.com/docs/#/displaying/format/
date_format: YYYY-MM-DD
time_format: HH:mm:ss
updated_option: date

# Pagination
## Set per_page to 0 to disable pagination
per_page: 10
pagination_dir: page

# Extensions
## Plugins: https://hexo.io/plugins/
## Themes: https://hexo.io/themes/
theme: next

# Deployment
## Docs: https://hexo.io/docs/deployment.html
minify:
  gzip:
    enable: false
  brotli:
    enable: false
  xml:
    enable: true
  json:
    enable: true

sitemap:
  path: sitemap.xml

symbols_count_time:
  symbols: true
  time: true
  total_symbols: true
  total_time: true
  exclude_codeblock: false

search:
  path: search.xml
  field: post
  content: true
  format: striptags

Others

No response

njzjz commented 5 months ago

Ahh, I found the reason. hexo-util is pinned for some reason that I can't remember.