Weird pnpm installing problem

Hey,

When I was installing a dependency with pnpm, it would install it normally, instead I came across this really strange error:

Error: Cannot find module 'm3u8stream/lib/parse-time'

I have tried using enable-pnpm to resolve this but with no luck

However my package.json is looking fine…

{
  "name": "nate-bot",
  "version": "2.0.0",
  "description": "Nate Bot Version: 6.7",
  "main": "server.js",
  "scripts": {
    "start": "node server.js"
  },
  "dependencies": {
    "express": "^4.16.4",
    "discord.js": "^11.5.1",
    "ytdl-core": "^0.29.2",
    "simple-youtube-api": "^5.1.1",
    "dbl-api": "^1.2.1",
    "dblapi.js": "^2.3.0",
    "node-superfetch": "^0.1.9",
    "cheerio": "^0.22.0",
    "quick.db": "^7.0.0-b21",
    "canvas-constructor": "^3.0.0",
    "canvas": "^2.5.0",
    "mal-scraper": "^2.6.1",
    "mathjs": "^5.10.2",
    "fortnite": "^4.3.2",
    "node-osu": "^1.3.2",
    "node-opus": "^0.3.1",
    "ascii-art": "^1.5.1",
    "jimp": "^0.6.4",
    "parse-ms": "^2.0.0",
    "nekos.life": "^2.0.4",
    "weather-js": "^2.0.0",
    "moment": "^2.24.0",
    "moment-duration-format": "^2.2.2",
    "enmap": "^4.8.6",
    "common-tags": "^1.8.0",
    "better-sqlite3": "^5.4.2",
    "body-parser": "^1.19.0",
    "gifencoder": "^2.0.1"
  },
  "engines": {
    "node": "8.x"
  },
  "repository": {
    "url": "https://glitch.com/edit/#!/hello-express"
  },
  "license": "MIT",
  "keywords": [
    "node",
    "glitch",
    "express"
  ]
}

Project: nate-devbot

You can try to install it with the Add Package option in package.json.

m3u8stream/lib/parse-time doesn’t exist in the Add Package Option.
Well, parse-time does but doesn’t resolve the problem.

Error will keep coming, regardless of me adding a new package, modifying package.json code or just running enable-pnpm in the console

I think parse time is a subpackage that already comes with the main package. Try to install only m3u8stream.

Nope, well heres the screenshot of what im getting:

Red boxes, means the packages I installed, other ones already existed

I searched a bit and seems like it is a bug with the package itself. Try to run in your console cp -r app/node_modules/m3u8stream/dist app/node_modules/m3u8stream/lib

Okay, I was getting this error

I also tried to rewind the project and still got the same errors…
I’ll try a remix and see if it fixes.

Ups. Forgot the / before the app.

Try cp -r /app/node_modules/m3u8stream/dist /app/node_modules/m3u8stream/lib

1 Like

Alright, this seemed to fix the issue! The Bot is online now

Thanks for your help

2 Likes

You’re welcome. Please click on solution on my message, so anyone has the same problem and see this will know how to fix it.

Another way to fix this is to use a more up to date version of ytdl-core.

Careful you don’t breach copyright or Glitch’s TOS by redistributing youtube videos on Glitch.

Hi, I do want to mention again that the same issue Error: Cannot find module 'm3u8stream/lib/parse-time' keeps coming back after pnpm initializes node_modules and does an auto reinstall of the packages (due to 12 hour restart of glitch projects).

This means I have to keep running the console command to get rid of the problem but it will keep coming back:
cp -r /app/node_modules/m3u8stream/dist /app/node_modules/m3u8stream/lib

@Glitch_Support Not sure what is exactly causing this and how to fix it properly… my project is nate-devbot

add a post-install script and add this to it

“cp -r /app/node_modules/m3u8stream/dist /app/node_modules/m3u8stream/lib”

that should fix your problem permanently.

what is does is after all installations, it runs that command, and continues with the code without any delay

1 Like