Using dockerode in nextjs

102 views Asked by At

Im trying use dockerode in Nextjs project.

Got this error: Can't resolve './crypto/build/Release/sshcrypto.node'.

Reproduce here: https://stackblitz.com/edit/nextjs-u81mh5?file=app%2Fapi%2Froute.ts

Thanks.

Edit: Add error message.

Module parse failed: Unexpected character '' (1:0)

You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders

(Source code omitted for this binary file)

Import trace for requested module:

./node_modules/ssh2/lib/protocol/crypto/build/Release/sshcrypto.node

./node_modules/ssh2/lib/protocol/crypto.js

./node_modules/ssh2/lib/protocol/keyParser.js

./node_modules/ssh2/lib/index.js

./node_modules/docker-modem/lib/ssh.js

./node_modules/docker-modem/lib/modem.js

./node_modules/dockerode/lib/docker.js

I could not find much posts related to this problem particularly in nextjs project. I have looked into the node-loader. But seems like nextjs needs the SWC compiler to function properly.

0

There are 0 answers