wechaty / getting-started

A Starter Project Template for Wechaty works out-of-the-box
https://gitpod.io/#https://github.com/wechaty/wechaty-getting-started
Apache License 2.0
774 stars 342 forks source link

SyntaxError: The requested module 'wechaty' does not provide an export named 'Contact' #257

Open yigeyanse opened 2 years ago

yigeyanse commented 2 years ago

I use example code ,when i start program ,it get error

code:

import 'dotenv/config.js'

import {
  Contact,
  Message,
  ScanStatus,
  WechatyBuilder,
  log,
} from 'wechaty'

import qrcodeTerminal from 'qrcode-terminal'

function onScan (qrcode, status) {
  if (status === ScanStatus.Waiting || status === ScanStatus.Timeout) {
    const qrcodeImageUrl = [
      'https://wechaty.js.org/qrcode/',
      encodeURIComponent(qrcode),
    ].join('')
    log.info('StarterBot', 'onScan: %s(%s) - %s', ScanStatus[status], status, qrcodeImageUrl)
........

error:
PS D:\个人\getting-started-main> node .\examples\test2.js
file:///D:/%E4%B8%AA%E4%BA%BA/getting-started-main/examples/test2.js:11
  ContactInterface,
  ^^^^^^^^^^^^^^^^
SyntaxError: The requested module 'wechaty' does not provide an export named 'ContactInterface'
    at ModuleJob._instantiate (node:internal/modules/esm/module_job:128:21)
    at async ModuleJob.run (node:internal/modules/esm/module_job:194:5)
    at async Promise.all (index 0)
    at async handleMainPromise (node:internal/modules/run_main:61:12)
huan commented 2 years ago

Could you please confirm whether you can run npm start with our getting started?

Make sure you are using Node.js 16+ and NPM 7+.

If you can not, please paste the output log message.

sunboye commented 1 year ago

import {FileBox, ScanStatus, WechatyBuilder, log } from 'wechaty' ^^^^^^^ SyntaxError: The requested module 'wechaty' does not provide an export named 'FileBox' at ModuleJob._instantiate (node:internal/modules/esm/module_job:123:21) at async ModuleJob.run (node:internal/modules/esm/module_job:189:5) at async Promise.all (index 0) at async ESMLoader.import (node:internal/modules/esm/loader:533:24) at async loadESM (node:internal/process/esm_loader:91:5) at async handleMainPromise (node:internal/modules/run_main:65:12)

版本:

$ npm --version 9.6.0

$ node --version v16.17.0