E:\Blog_Butterfly>hexo n 清除缓存把npm给清理了 node:internal/modules/cjs/loader:1222 throw err; ^
Error: Cannot find module 'E:\nodejs\node_global\node_modules\hexo-cli\bin\hexo' at Module._resolveFilename (node:internal/modules/cjs/loader:1219:15) at Module._load (node:internal/modules/cjs/loader:1045:27) at TracingChannel.traceSync (node:diagnostics_channel:315:14) at wrapModuleLoad (node:internal/modules/cjs/loader:215:24) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:158:5) at node:internal/main/run_main_module:30:49 { code: 'MODULE_NOT_FOUND', requireStack: [] }
Error: Cannot find module 'E:\nodejs\node_global\node_modules\cnpm\bin\cnpm.js' at Module._resolveFilename (node:internal/modules/cjs/loader:1219:15) at Module._load (node:internal/modules/cjs/loader:1045:27) at TracingChannel.traceSync (node:diagnostics_channel:315:14) at wrapModuleLoad (node:internal/modules/cjs/loader:215:24) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:158:5) at node:internal/main/run_main_module:30:49 { code: 'MODULE_NOT_FOUND', requireStack: [] }
Node.js v22.4.0
解决办法很简答,把目录下的文件全给删了
再把项目的中的依赖也删了就能重新使用了,比如:
1 2 3 4 5
$ hexo ERROR Cannot find module 'hexo' from 'E:\Blog_Butterfly' ERROR Local hexo loading failed in E:\Blog_Butterfly ERROR Try running: 'rm -rf node_modules && npm install --force'
删除模块并重新安装
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
Yee@Yee MINGW64 /e/Blog_Butterfly $ rm -rf node_modules npm install --force npm warn using --force Recommended protections disabled. npm warn deprecated cuid@2.1.8: Cuid and other k-sortable and non-cryptographic ids (Ulid, ObjectId, KSUID, all UUIDs) are all insecure. Use @paralleldrive/cuid2 instead. npm warn deprecated highlight.js@9.18.5: Support has ended for 9.x series. Upgrade to @latest