# Ewelink API

**URL:** <https://community.openhab.org/t/ewelink-api/149966>\
**Category:** Scripts & Rules\
**Tags:** ewelink\
**Created:** [September 27, 2023, 8:14pm UTC](https://community.openhab.org/t/ewelink-api/149966 "2023-09-27T20:14:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![MartOs](https://community.openhab.org/user_avatar/community.openhab.org/martos/32/64748_2.png) [@MartOs](https://community.openhab.org/u/MartOs)\
**Post date:** [September 27, 2023, 8:14pm UTC](https://community.openhab.org/t/ewelink-api/149966/1 "2023-09-27T20:14:04Z")

</div>

Been trying to make this work.

> **[Getting Started | eWeLink API](https://ewelink-api.vercel.app/docs/introduction)**
>
> Getting started with eWeLink API for JavaScript

npm install seemed to go fine.

To import, it gives this example

```javascript
const ewelink = require('ewelink-api');

```

but I get an error:

```yaml
TypeError: Cannot load CommonJS module: 'events'

```

Any ideas how to make this work?

---

<div class="post-metadata">

**Author:** ![rlkoshak](https://community.openhab.org/user_avatar/community.openhab.org/rlkoshak/32/75251_2.png) [@rlkoshak](https://community.openhab.org/u/rlkoshak)\
**Post date:** [September 27, 2023, 8:18pm UTC](https://community.openhab.org/t/ewelink-api/149966/2 "2023-09-27T20:18:26Z")

</div>

I assume you are trying to use this with OH Rules?

One important thing to note is GraalVM JavaScript the way it’s implemented in the openHAB add-on only provides a Node.js _like_ environment. There is no guarantee that any given node module will work. It for sure will not work if it depends on anything related to the Node.js event loop. Tthe name `events` hints that may be the case here.
