DeepSpaceHarbor / hexo-bridge

Command center for websites powered by hexo.
GNU General Public License v3.0
32 stars 6 forks source link

Error: Cannot find module 'yawn-yaml/cjs' in docker building of latest hexo #183

Closed githubbbie closed 1 month ago

githubbbie commented 1 month ago

Getting the same error on two different docker setups trying to use your admin plugin.

/hexo/node_modules # hexo server
INFO  Validating config
ERROR Plugin load failed: hexo-bridge
Error: Cannot find module 'yawn-yaml/cjs'
Require stack:
- /hexo/node_modules/hexo-bridge/setting.js
- /hexo/node_modules/hexo-bridge/post.js
- /hexo/node_modules/hexo-bridge/index.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1248:15)
    at Module._load (node:internal/modules/cjs/loader:1074:27)
    at TracingChannel.traceSync (node:diagnostics_channel:315:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:217:24)
    at Module.require (node:internal/modules/cjs/loader:1339:12)
    at require (node:internal/modules/helpers:135:16)
    at Object.<anonymous> (/hexo/node_modules/hexo-bridge/setting.js:6:14)
    at Module._compile (node:internal/modules/cjs/loader:1546:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1691:10)
    at Module.load (node:internal/modules/cjs/loader:1317:32)
    at Module._load (node:internal/modules/cjs/loader:1127:12)
    at TracingChannel.traceSync (node:diagnostics_channel:315:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:217:24)
    at Module.require (node:internal/modules/cjs/loader:1339:12)
    at require (node:internal/modules/helpers:135:16)
    at Object.<anonymous> (/hexo/node_modules/hexo-bridge/post.js:4:18)
    at Module._compile (node:internal/modules/cjs/loader:1546:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1691:10)
    at Module.load (node:internal/modules/cjs/loader:1317:32)
    at Module._load (node:internal/modules/cjs/loader:1127:12)
    at TracingChannel.traceSync (node:diagnostics_channel:315:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:217:24)
INFO  Start processing
INFO  Hexo is running at http://localhost:4000/ . Press Ctrl+C to stop.

Attaching package-lock.json and package.json. package.json package-lock.json

Also here is a test setup:

Dockerfile.txt docker-compose.yml.txt

Save to disk:

mkdir hexo-test
mv Dockerfile.txt Dockerfile
mv docker-compose.yml.txt docker-compose.yml

To run and see the error:

docker-compose up

See the error?

If you want to diagnore more or copy logs out, you may into /hexo/public after you are inside the container:

docker-compose down
docker-compose up -d
docker-compose exec hexo ash

Would like to build on top of our code, but first need to get it running :) and check it out. THANKS

DeepSpaceHarbor commented 1 month ago

Hey @githubbbie, thank you for reporting this issue!

I was able to reproduce the problem and fix it in the new 2.0.3 version of the package.

If you run your setup with docker compose up --build it should rebuild the setup with the correct version and work as expected.

githubbbie commented 1 month ago

AWESOME!

I got it working with: docker-compose build --no-cache && docker-compose up

FIXED!