Problem to use api methods

Hi dev,

I recently created an api called jkanime using Typescript. I have the problem after publishing it on the npm platform, it shows me an error when using the API functions.

The error comes from the imports of some packages that I use to create the jkanime API.

Here I leave the api repository, if someone wants to help me how to correctly upload the package to the npm platform. https://github.com/ChrisMichaelPerezSantiago/jkanime


var jkanime = require("jkanime");

jkanime.lastAnimesAdded()
    .then(doc => console.log(doc));

Error

import * as cheerio from 'cheerio';
       ^

SyntaxError: Unexpected token *
    at Module._compile (internal/modules/cjs/loader.js:721:23)
    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)
    at Module.require (internal/modules/cjs/loader.js:690:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (C:\Users\c\Desktop\jkanime\test\index.js:1:13)
    at Module._compile (internal/modules/cjs/loader.js:776:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! test@1.0.0 start: `node index.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the test@1.0.0 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\c\AppData\Roaming\npm-cache\_logs\2019-08-16T01_07_55_949Z-debug.log

RunKit Link: https://npm.runkit.com/jkanime

Hi @chrismperez,

I don’t think the RunKit notebook currently supports TypeScript.
You could try publishing the transpiled code.

Hope that helps,
Ron

1 Like