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

TypeError: Wechat is not a constructor #51

Open
libo83 opened this issue Jul 19, 2020 · 1 comment
Open

TypeError: Wechat is not a constructor #51

libo83 opened this issue Jul 19, 2020 · 1 comment

Comments

@libo83
Copy link

libo83 commented Jul 19, 2020

Hi,
I found this repo from Medium post. Great job!

However, after I checkout master repo I got follow Error, could you please help?

PS C:\Users\xxxx\Documents\GitHub\wechat_programs\WeChat-JSSDK-Backend> npm start

[email protected] start C:\Users\xxxx\Documents\GitHub\wechat_programs\WeChat-JSSDK-Backend
node ./bin/www

C:\Users\xxxx\Documents\GitHub\wechat_programs\WeChat-JSSDK-Backend\app.js:30
const wx = new Wechat(wechatConfig);
^

TypeError: Wechat is not a constructor
at Object. (C:\Users\xxxx\Documents\GitHub\wechat_programs\WeChat-JSSDK-Backend\app.js:30:12)
at Module._compile (internal/modules/cjs/loader.js:1138:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
at Module.load (internal/modules/cjs/loader.js:986:32)
at Function.Module._load (internal/modules/cjs/loader.js:879:14)
at Module.require (internal/modules/cjs/loader.js:1026:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object. (C:\Users\xxxx\Documents\GitHub\wechat_programs\WeChat-JSSDK-Backend\bin\www:7:11)
at Module._compile (internal/modules/cjs/loader.js:1138:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
at Module.load (internal/modules/cjs/loader.js:986:32)
at Function.Module._load (internal/modules/cjs/loader.js:879:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: node ./bin/www
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] 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\xxxx\AppData\Roaming\npm-cache_logs\2020-07-19T08_03_03_260Z-debug.log
PS C:\Users\xxxx\Documents\GitHub\wechat_programs\WeChat-JSSDK-Backend> npm -v
6.14.5
PS C:\Users\xxxx\Documents\GitHub\wechat_programs\WeChat-JSSDK-Backend> node -v
v12.18.2
PS C:\Users\xxxx\Documents\GitHub\wechat_programs\WeChat-JSSDK-Backend> npm run
Lifecycle scripts included in wechat-demo:
start
node ./bin/www

available via npm run-script:
dev
nodemon ./bin/www

Is this coming from the version of nodejs and npm? I am using the latest version as below:
npm: 6.14.5
node: v12.18.2

Thanks

@JasonBoy
Copy link
Owner

The medium post was a little bit old, pls check out the readme here in the repo:

const {Wechat} = require('wechat-jssdk');
const wx = new Wechat(wechatConfig);

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

2 participants