Cannot find module 'm3u8stream/lib/parse-time' - node.js

is there anyway to fix this? I've been trying to resolve this myself but I give up
throw err;
^
Error: Cannot find module 'm3u8stream/lib/parse-time'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
at Function.Module._load (internal/modules/cjs/loader.js:508:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.<anonymous> (/rbd/pnpm-volume/71b5ddd8-2a78-46fc-aba4-68049f14880d/node_modules/.registry.npmjs.org/ytdl-core/1.0.0/node_modules/ytdl-core/lib/info-extras.js:5:21)
at Module._compile (internal/modules/cjs/loader.js:701:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
at Module.load (internal/modules/cjs/loader.js:600:32)
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
at Function.Module._load (internal/modules/cjs/loader.js:531:3)

This works for me, at the root of the project:
cp -r ./node_modules/m3u8stream/dist ./node_modules/m3u8stream/lib
I really don't understand why, I assume is some bug of versions, (mentioned in the previous comments) cause for some reason it needs the both folders dist and lib (with the same content apparently)

Solved by: Chills
Comment: did you install parse-time?
Answer: no I didn't, I did get it installed but also I've learned from a friend about ytdl-core update required dist instead of lib
Source: https://github.com/fent/node-ytdl-core/pull/520
Solution:
packages needed installing: m3u8stream and parse-time
code needed in main file:
const m3u8stream = require('m3u8stream');
const parseTime = require('m3u8stream/dist/parse-time');

Related

throw new TypeError('The super constructor to "inherits" must not ' +

I am trying to build my nodejs application. but i am always getting this error.
util.js:988
throw new TypeError('The super constructor to "inherits" must not ' +
^
TypeError: The super constructor to "inherits" must not be null or undefined
at Object.inherits (util.js:988:11)
at Object.<anonymous> (D:\CIDE-Backend\CIDE-BACKEND\node_modules\zetta\node_modules\spdy\lib\spdy\connection.js:86:6)
at Module._compile (module.js:573:30)
at Object.Module._extensions..js (module.js:584:10)
at Module.load (module.js:507:32)
at tryModuleLoad (module.js:470:12)
at Function.Module._load (module.js:462:3)
at Module.require (module.js:517:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (D:\CIDE-Backend\CIDE-BACKEND\node_modules\zetta\node_modules\spdy\lib\spdy.js:20:19)
at Module._compile (module.js:573:30)
at Object.Module._extensions..js (module.js:584:10)
at Module.load (module.js:507:32)
at tryModuleLoad (module.js:470:12)
at Function.Module._load (module.js:462:3)
at Module.require (module.js:517:17)
[nodemon] app crashed - waiting for file changes before starting...
i followed this solution but still i am getting same error.
my node version is 8.4.0
my npm version is 5.5.1
Can you tell me how can i solve this error.?
Your dependency zetta is including an ancient version of spdy which is not compatible with you current version of Node. There is currently an open issue on zetta's github about this, which has a work around:
process.EventEmitter = require('events').EventEmitter
const zetta = require('zetta')
Your mileage may vary on that hack, I have not tested it myself. Alternatively, you could wait for the zetta team to fix their dependency or downgrade your node installation.

Custom dependency require Electron

With the package.json, it's possible to do something like this
"dependencies": {
"WindowManager": "./lib/WindowManager"
},
But when trying to do this in Electron, it gives me this error:
App threw an error during load
Error: Cannot find module 'WindowManager'
at Module._resolveFilename (module.js:470:15)
at Function.Module._resolveFilename (.../desktop/node_modules/electron/dist/Electron.app/Contents/Resources/electron.asar/common/reset-search-paths.js:35:12)
at Function.Module._load (module.js:418:25)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (.../desktop/lib/init.js:15:35)
at Object.<anonymous> (.../desktop/lib/init.js:22:3)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
Is it because of Electron, or am I doing something wrong?
./lib/WindowManager is a folder with a package.json in it with a main pointing to the WindowManager.js, so that should work.
The case you try to do normally works, make sure that the dependency "WindowManager" has been properly copied by the build tools to either:
.../desktop/node_modules/electron/dist/Electron.app/Contents/Resources/app.asar/node_modules
or
.../desktop/node_modules/electron/dist/Electron.app/Contents/Resources/node_modules
If WindowManager does not exist in the disted node_modules there is something wrong with your build process, hard to be more precise than that.

gulp command not combining JavaScript files in Laravel framework. Gives strange error

I have the following elixir function in Laravel framework:
var elixir = require('laravel-elixir');
elixir(function(mix) {
mix.sass('app.scss');
mix.styles(['bootstrap.min.css','app.css'], null, 'public/css');
mix.scripts(['bootstrap.min.js','jquery.min.js'], null, 'public/js');
mix.version('public/css/all.css');
});
The null parameters are supposed to automatically create all.css in public/css folder and all.js in public/js folder. While the css file is combined properly I get the following error for javascript files:
[12:53:30] 'scripts' errored after 952 ms
[12:53:30] Error: Cannot find module '../internal/assignWith'
at Function.Module._resolveFilename (module.js:337:15)
at Function.Module._load (module.js:287:25)
at Module.require (module.js:366:17)
at require (module.js:385:17)
at Object.<anonymous> (/htdocs/t2ci/node_modules/laravel-elixir/node_modules/gulp-babel/node_modules/babel-core/node_modules/lodash/object/assign.js:1:80)
at Module._compile (module.js:435:26)
at Object.Module._extensions..js (module.js:442:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:311:12)
at Module.require (module.js:366:17)
[12:53:30] Error in plugin 'run-sequence'
Message:
An error occured in task 'scripts'.
I've wasted several hours searching the internet for solutions but I haven't found any yet. Would anyone have encountered this sort of error?
Your node_modules might be corrupted. Does it work properly after rm -rf node_modules && npm install?

Cannot find module in Nodejs

module.js:340
throw err;
^
Error: Cannot find module './models/todo'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (C:\Users\Basel\Desktop\Todo List\routes\api.js:1:74)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
C:\Users\Basel\Desktop\Todo List>
Why this application won't start up? I've already tried a global npm install.
In ./models/todo, the period indicates that node will look in the same folder that api.js is in, which would look for \Todo List\routes\models\todo.js. This does not start from the root of the application. To require this, you'll need to us two periods to jump up a level, and specify the app path as well:
var todo = require('../app/models/todo');
maybe you did not set the system value : NODE_PATH; it should point to your global module location;
in Linux: export NODE_PATH=/usr/local/lib/node_modules/ works good for me;
in my case, the file name i had given in my require statement was wrong. I had my models file named posts.js and i was using require('./models/post'). It worked after i changed it to require ('.models/posts')

Basic db-mysql setup error

I just started using node.js for my project and tried making a connection to MySQL and inserting basic values. But I keep getting the following error:
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: Unable to load shared library /Users/****/nodeJS/node_modules/db-mysql/build/Release/mysql_bindings.node
at Object..node (module.js:472:11)
at Module.load (module.js:348:31)
at Function._load (module.js:308:12)
at Module.require (module.js:354:17)
at require (module.js:370:17)
at Object.<anonymous> (/Users/****/nodeJS/node_modules/db-mysql/db-mysql.js:18:15)
at Module._compile (module.js:441:26)
at Object..js (module.js:459:10)
at Module.load (module.js:348:31)
at Function._load (module.js:308:12)
I did as was instructed, I specified the MYSQL_CONFIG environment variable:
$ export MYSQL_CONFIG=/usr/local/mysql/bin/mysql_config
maybe it's too late and I hope you solved this problem on your own, but it might be useful for other people experiencing the same issue.
What I did to solve it is to set the following variable:
export DYLD_LIBRARY_PATH=<your absolute path to mysql lib folder>
in my case it is:
export DYLD_LIBRARY_PATH=/usr/local/mysql-5.5.25-osx10.6-x86_64/lib/
Tested on MacOS Lion 10.7.4

Resources