SukkaW / hexo-theme-suka

🎨Modern, powerful and simple theme for Hexo.
https://theme-suka.skk.moe
GNU General Public License v3.0
616 stars 49 forks source link

TypeError: require(...) is not a function #173

Open pure01fx opened 7 months ago

pure01fx commented 7 months ago

I certify that I have first consulted (check with "x")

我确认我已经查看了 (选择时请使用 "x" 取代方括号中的空格)


如果你遇到了运行 hexo g hexo s 时报错

If you get error when you are running hexo s hexo g.

Node.js and NPM Information

Node.js 和 NPM 的相关信息

$ node -v          
v20.11.0
$ npm -v 
10.2.4

Package dependencies Information

依赖包相关信息

{
  "name": "hexo-site",
  "version": "0.0.0",
  "private": true,
  "scripts": {
    "build": "hexo generate",
    "clean": "hexo clean",
    "deploy": "hexo deploy",
    "server": "hexo server"
  },
  "hexo": {
    "version": "7.2.0"
  },
  "dependencies": {
    "hexo": "^7.0.0",
    "hexo-generator-archive": "^2.0.0",
    "hexo-generator-category": "^2.0.0",
    "hexo-generator-index": "^3.0.0",
    "hexo-generator-tag": "^2.0.0",
    "hexo-renderer-ejs": "^2.0.0",
    "hexo-renderer-marked": "^6.0.0",
    "hexo-renderer-pug": "^3.0.0",
    "hexo-renderer-stylus": "^3.0.0",
    "hexo-server": "^3.0.0",
    "hexo-theme-landscape": "^1.0.0"
  }
}
{
  "name": "hexo-theme-suka",
  "version": "1.3.3",
  "description": "Modern, powerful and simple theme for Hexo",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "setup": "npm cache clean && npm install",
    "lint": "bash lint.sh"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/SukkaW/hexo-theme-suka.git"
  },
  "keywords": [
    "hexo",
    "hexo-theme",
    "suka",
    "sukkaw"
  ],
  "author": "SukkaW",
  "license": "GPL-3.0",
  "bugs": {
    "url": "https://github.com/SukkaW/hexo-theme-suka/issues"
  },
  "homepage": "https://github.com/SukkaW/hexo-theme-suka#readme",
  "devDependencies": {
    "ejs-lint": "0.3.0",
    "eslint": "6.5.1",
    "gulp": "4.0.2",
    "gulp-autoprefixer": "^7.0.1",
    "gulp-clean-css": "4.2.0",
    "gulp-rename": "1.4.0",
    "gulp-uglify": "3.0.2",
    "sass-lint": "1.13.1"
  },
  "dependencies": {
    "node-prismjs": "0.1.2",
    "prismjs": "^1.17.1",
    "qr-image": "3.2.0"
  }
}

Hexo version

Hexo 版本号

hexo: 7.2.0
hexo-cli: 4.3.2
os: win32 10.0.22631 undefined
node: 20.11.0
acorn: 8.11.2
ada: 2.7.4
ares: 1.20.1
base64: 0.5.1
brotli: 1.0.9
cjs_module_lexer: 1.2.2
cldr: 43.1
icu: 73.2
llhttp: 8.1.1
modules: 115
napi: 9
nghttp2: 1.58.0
nghttp3: 0.7.0
ngtcp2: 0.8.1
openssl: 3.0.12+quic
simdutf: 4.0.4
tz: 2023c
undici: 5.27.2
unicode: 15.0
uv: 1.46.0
uvwasi: 0.0.19
v8: 11.3.244.8-node.17
zlib: 1.2.13.1-motley-5daffc7

Error Log

报错日志

ERROR Script load failed: themes\suka\scripts\index.js
TypeError: require(...) is not a function
    at Object.<anonymous> (D:\hexo-blog\themes\suka\includes\tasks\welcome.js:3:35)
    at ...

Related: Issue from another hexo theme

BTW, welcome.js 的 export 似乎没有被调用

pure01fx commented 7 months ago

suka.patch

htszh commented 2 months ago

问题有解决吗