OSSPhilippines / paymongo

A lightweight Node.js client for Paymongo API
https://paymongo.ossph.org/
MIT License
87 stars 24 forks source link

CommonJS import not working #16

Closed micahbule closed 4 years ago

micahbule commented 4 years ago

Describe the bug I want to use the library without ES6 module imports. Based on your package, it was already transpiled by Babel, but when I import it using require() it gives me the error below.

Error: Cannot find module '@babel/runtime/helpers/classCallCheck'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
    at Function.Module._load (internal/modules/cjs/loader.js:562:25)
    at Module.require (internal/modules/cjs/loader.js:690:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (/home/mico/Projects/paymongo-server/node_modules/paymongo/dist/index.js:1:134)
    at Module._compile (internal/modules/cjs/loader.js:776:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)

To Reproduce Steps to reproduce the behavior:

  1. Install the module to a project
  2. Import it using require()
  3. Run the project

Expected behavior Module should be successfully imported without errors.

Current behavior see error above

Desktop (please complete the following information):

micahbule commented 4 years ago

An additional report.

I think you forgot to put the module dependencies of the library in package.json. I tried to run the module under Babel for good measure, but now it's missing the request module.

micahbule commented 4 years ago

An additional report.

I think you forgot to put the module dependencies of the library in package.json. I tried to run the module under Babel for good measure, but now it's missing the request module.

PR #17 as fix for this one.