SideeX / sideex-api

SideeX JavaScript API is a JS library running on a webpage for recording and playing web browsing behavior
Apache License 2.0
22 stars 5 forks source link

Error when importing @sideex/api #3

Closed benebsiny closed 4 years ago

benebsiny commented 4 years ago

I've installed @sideex/api via npm. I used require to import @sideex/api, and it showed the following error messages. (P.S. If I used import to import the module, the result was the same)

❯ node index.js
internal/modules/cjs/loader.js:345
      throw err;
      ^

Error: Cannot find module 'C:\Users\user\Desktop\Program\NodeJS\SideexDemo\node_modules\@sideex\api\index.bundle.js'. Please verify that the package.json has a valid "main" entry
    at tryPackage (internal/modules/cjs/loader.js:337:19)
    at Function.Module._findPath (internal/modules/cjs/loader.js:702:18)
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:1052:27)
    at Function.Module._load (internal/modules/cjs/loader.js:911:27)
    at Module.require (internal/modules/cjs/loader.js:1125:19)
    at require (internal/modules/cjs/helpers.js:75:18)
    at Object.<anonymous> (C:\Users\user\Desktop\Program\NodeJS\SideexDemo\index.js:1:1)
    at Module._compile (internal/modules/cjs/loader.js:1236:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1257:10)
    at Module.load (internal/modules/cjs/loader.js:1085:32) {
  code: 'MODULE_NOT_FOUND',
  path: 'C:\\Users\\user\\Desktop\\Program\\NodeJS\\SideexDemo\\node_modules\\@sideex\\api\\package.json',
  requestPath: '@sideex/api'
}
Jerryh001 commented 4 years ago

It should be fix now, please try 0.9.3.

benebsiny commented 4 years ago

It works, thank you 👍

benebsiny commented 4 years ago

I used import to import sideex.

import { SideeX } from "@sideex/api"
var sideex = new SideeX();

An error occurred with message Attempted import error: 'SideeX' is not exported from '@sideex/api'.

(P.S. I also tried import SideeX from "@sideex/api", the error message is Attempted import error: '@sideex/api' does not contain a default export (imported as 'SideeX'). )

Jerryh001 commented 4 years ago

Please try 0.9.4 with

import { SideeX } from "@sideex/api"
benebsiny commented 4 years ago

Sorry, the same error message still shows there

Jerryh001 commented 4 years ago

Just found the root cause and 0.9.5 has been released, please try again.

benebsiny commented 4 years ago

It works 👍