wechaty / puppet-wechat

Wechaty Puppet Provider for WeChat
https://www.npmjs.com/package/wechaty-puppet-wechat
Apache License 2.0
419 stars 71 forks source link

Which is the correct package version #201

Closed shangdev closed 2 years ago

shangdev commented 2 years ago

current version:

  "dependencies": {
    "isomorphic-fetch": "^3.0.0",
    "ix": "^4.5.2",
    "wechaty": "^1.11.12",
    "wechaty-puppet-wechat": "^1.11.11"
  }

启动项目报错:

$ npm start

> wechatwebbot_js@1.0.1 start D:\xampp\htdocs\WechatWebBot_JS
> node index.js

D:\WechatWebBot_JS\node_modules\wechaty-puppet-service\dist\cjs\src\client\puppet-service.js:1157
        timestamp ??= 0;
                  ^^^

SyntaxError: Unexpected token '??='
    at wrapSafe (internal/modules/cjs/loader.js:979:16)
    at Module._compile (internal/modules/cjs/loader.js:1027:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (D:\xampp\htdocs\WechatWebBot_JS\node_modules\wechaty-puppet-service\dist\cjs\src\mod.js:6:29)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! wechatwebbot_js@1.0.1 start: `node index.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the wechatwebbot_js@1.0.1 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Administrator\AppData\Roaming\npm-cache\_logs\2022-01-15T10_34_53_970Z-debug.lo
GaryDu0123 commented 2 years ago

我遇到过相同的问题, 应该是nodejs版本有些低了不支持??=这个运算符, 换到最新的LTS版本试试?

shangdev commented 2 years ago

@GaryDu0123 Node版本是16.13.1,不低了

shangdev commented 2 years ago

已解决 1、package.json 添加 type: "module" 1、require 修改为 import