Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npm 7.21.1 node16.9.1 Ubuntu 22.04.1 LTS can not run, because The requested module 'wechaty' is a CommonJS module, which may not support all module.exports as named exports. Could every body tell me why? #27

Closed
slongli opened this issue Dec 11, 2022 · 4 comments

Comments

@slongli
Copy link

slongli commented Dec 11, 2022

import { WechatyBuilder, ScanStatus, log } from "wechaty";
^^^^^^^^^^^^^^
SyntaxError: Named export 'WechatyBuilder' not found. The requested module 'wechaty' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:

import pkg from 'wechaty';
const { WechatyBuilder, ScanStatus, log } = pkg;

at ModuleJob._instantiate (node:internal/modules/esm/module_job:124:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:179:5)
at async Loader.import (node:internal/modules/esm/loader:178:24)
at async Object.loadESM (node:internal/process/esm_loader:68:5)
at async handleMainPromise (node:internal/modules/run_main:63:12)
@wangrongding
Copy link
Owner

Try using the node LTS version

@ronaldox
Copy link

Try using the node LTS version

我和他是一样的错,更换了nodejs最新LTS版本也不行

@slongli
Copy link
Author

slongli commented Dec 13, 2022 via email

@wangrongding
Copy link
Owner

或者先参考这个方案。
#54 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants