Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to find the imported file or module 'events' #73

Open
IOIIOOIO opened this issue Jul 6, 2021 · 2 comments
Open

Unable to find the imported file or module 'events' #73

IOIIOOIO opened this issue Jul 6, 2021 · 2 comments

Comments

@IOIIOOIO
Copy link

IOIIOOIO commented Jul 6, 2021

On compilation I receive the following error:

Unable to find the imported file or module 'events'.

the source of the error is on line 2 of index.js:

const EventEmitter = require('events').EventEmitter.

This is an old project that was previously working. I have tried deleting my node_modules directory and reinstalled packages - but still the same error.

@haydentech
Copy link

haydentech commented Jun 7, 2022

I solved this by adding the events module to my package.json:

npm i events

I assume yt-player doesn't pull this in automatically because it may or may not be needed depending on your target.

@hyvyys
Copy link

hyvyys commented May 4, 2023

The above does not solve the problem, at least in Node 16.13.0. It gets rid of the runtime error but then the players don't load. To use the events npm package, which matches the Node.js 11.13.0 API, the import should be:

const EventEmitter = require('events')

instead of

const EventEmitter = require('events').EventEmitter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants