SavageCore / node-ffprobe-installer

Platform independent binary installer of FFprobe for node projects
https://www.npmjs.com/package/@ffprobe-installer/ffprobe
72 stars 29 forks source link

Need help regarding upgrading from v1.4.1 to v2.1.2 #309

Closed xeoshow closed 1 month ago

xeoshow commented 1 month ago

Hello,

I am using previous version (v1.4.1) of node-ffprobe-installer, and my node is version 14, works very well. But recently I have upgraded node-ffprobe-installer to v2.1.2, got problem and can not work. Just would like to know why changing "require('os')" to "require('node:os')"? My error log shows this is the problem from ... IMHO, since require('os') works on both old versions and new versions of node, seems require('os') and require('path') are better ways? Great thanks for help.

https://github.com/SavageCore/node-ffprobe-installer/blob/v2.1.2/index.js

const os = require('node:os');
const process = require('node:process');
......

https://github.com/SavageCore/node-ffprobe-installer/blob/v1.4.1/index.js

const os = require('os');
const path = require('path');
......
SavageCore commented 1 month ago

Node v14.18.0 should work

We're on v20.16.0 as LTS, perhaps time to upgrade! ;)

xeoshow commented 1 month ago

Hello @SavageCore ,

Thanks for reply. Actually I have upgraded my node from 14 to 20.12.2, and still the same problem. My latest env is as below:

rockylinux 8.8 64bit
node 20.12.2
npm 10.5.0
pnpm 9.0.2

After investigating, the problem is caused by esm package which I have used in my project: https://github.com/standard-things/esm https://www.npmjs.com/package/esm

esm is the world’s most advanced ECMAScript module loader. This fast, production ready, zero dependency loader is all you need to support ECMAScript modules in Node 6+.

esm is widely used (2,581,114 downloads per week now) but seems not that active for years. And "node:XXX" is not supported by esm for now: https://github.com/standard-things/esm/issues/904

I also checked another similar project: https://github.com/kribblo/node-ffmpeg-installer/blob/master/index.js

node-ffmpeg-installer has also used the "require('os')" in its latest version, and is also quite popular (329,548 downloads per week): https://www.npmjs.com/package/@ffmpeg-installer/ffmpeg

I really love node-ffprobe-installer for its convenience, and hopefully it could support more scenarios. Your any help is highly appreciated!

Best regards, Jason