A new beginner need some help

Started using a alreade created project

I have som problems shown below.
Think i need to do som update regarding nodes to make it run?

Thanks in advance

Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /home/jontegubben/automatisering/nordpool-ifttt/index.js
at Object.Module._extensions…js (internal/modules/cjs/loader.js:1015:13)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at /home/jontegubben/automatisering/nordpool-ifttt/node_modules/pm2/lib/ProcessContainer.js:303:25
at wrapper (/home/jontegubben/automatisering/nordpool-ifttt/node_modules/async/internal/once.js:12:16)
at next (/home/jontegubben/automatisering/nordpool-ifttt/node_modules/async/waterfall.js:96:20)
at /home/jontegubben/automatisering/nordpool-ifttt/node_modules/async/internal/onlyOnce.js:12:16
at WriteStream. (/home/jontegubben/automatisering/nordpool-ifttt/node_modules/pm2/lib/Utility.js:186:13)
at WriteStream.emit (events.js:314:20)
at internal/fs/streams.js:366:10

It would help if you could tell us what you did when this error appears?

Looks like your node package.json contains a line

“type”: “module”

In that way you cannot use require to add new dependencies. You need to use import. Mostly its only another syntax: But as we do not know what you have done we cannot help more

1 Like

I have installed that project shown in the post.

I have installed everything in the readme

git clone https://github.com/samuelmr/nordpool-ifttt
npm install
cd nordpool-ifttt
cp config-sample.js config.js
$EDITOR config.js

I have checked in the errorlog and some of the nodes contain reguire instead of import.
For an example only_once.js.

So shall I update all nodes with some command?
I tested to remove the libary nodes_modules and reinstalled them with npm install.

I have used this environment for 2 says😃
Sorry gor my dumb questions

what is

npm -version

giving you?

npm: ‘8.5.1’,
node: ‘12.22.9’,
v8: ‘’,
uv: ‘1.43.0’,
zlib: ‘1.2.11’,
brotli: ‘1.0.9’,
ares: ‘1.18.1’,
modules: ‘72’,
nghttp2: ‘1.43.0’,
napi: ‘8’,
llhttp: ‘2.1.4’,
http_parser: ‘2.9.4’,
openssl: ‘1.1.1m’,
cldr: ‘40.0’,
icu: ‘70.1’,
tz: ‘2022b’,
unicode: ‘14.0’

So I have done the same steps on my computer and no problems.

created a new directory, then

git clone https://github.com/samuelmr/nordpool-ifttt
npm install
cd nordpool-ifttt
cp config-sample.js config.js

all good. As I have no config I didn’t start the last command

So any suggestions😃

Br Jonas

I think if you run npm start the system vill suggest comnands for you to install everything

I cannot use npm start because I have no config. At the end I have no idea what this software is good for, so I cannot help here

I think the instructions on the repo are slightly unclear in that they have you installing the dependencies before you change into the correct directory.

Here’s what I did:

git clone https://github.com/samuelmr/nordpool-ifttt
cd nordpool-ifttt
npm install
cp config-sample.js config.js
npm run start

And the output:

Which I guess is what we are aiming for, but like Thalius, I have no idea what the software should do.

Thanks for your support.
This program is used for reading out the spot price for electricuty at nordpool and send webhooks when the price is high/low and normal.

This can I then use in ifttt to automaticly start stop the heating in my house.

I have fixed price now snd unti 20231130, so I have more the a year to make it work. :smiley:

I will follow your instructions and see if itcworks for me now.


Acually James I have the same function as you also from the beginning.

But if you look in the logs in the hidden direcory .pm2 you can se that the output log is empty and the debug log contanin the error that mentioned
from the beginning

Last post is the direcories
All the files are at
And I start the script with “npm run start”, in above folder but the debuglog contain the same errors

That’s weird. In ~/.pm2/logs/Nordpool-IFTTT-trigger-out-0.log I have:

2022-09-28T16:40:10+02:00: Getting prices for today
28.9. 0:00 12.047 nordpool_price_high
28.9. 23:00 7.461 nordpool_price_normal

And ~/.pm2/logs/Nordpool-IFTTT-trigger-error-0.log is empty.

I tried downgrading to Node v12.22.9 and npm v8.5.1, but I could not reproduce the error.

Sorry :frowning:

Perhaps you could try upgrading to the latest Node and newest version of npm? See if that helps…
Otherwise, try Googling the error and see if that takes you anywhere.

Last question and then I will set you free :smiley:
Which node and npm vwrsion arecyou using
Br Jonas

Thank for the tip
I forced in the latest versions
Sudo npm install npm@version
The same for node …
So now it works and my knowledge has increased with 500 %:smiley:

1 Like

Glad you got it working :slight_smile:

By way of some parting advice, it is not a good idea to run sudo npm install anything. This is a security risk for your system.

A version manager such as nvm would help negate this issue.

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.