The most unseen and unwanted thing with adding packages

I created a new project few minutes back, opened the console and did this command
npm i hydrabolt/discord.js
The discord.js package was then installed, then I did the next command:
npm i dirigeants/klasa
The klasa package was also installed then. but when I refreshed through the console and tried running my app then I got the error, cannot find module klasa

With some confusion I reopened the console and uninstalled both the packages then did the first command again i.e. discord.js one.
then I ran npm ls and saw that it was successfully installed.

Then I ran the second command i.e. klasa one.
then I again ran npm ls and saw that klasa was installed now, but discord.js was uninstalled out of nowhere.
I even got this when I ran npm ls this time.

npm ERR! missing: discord.js@github:hydrabolt/discord.js, required by test-project2@1.0.0

I am totally confused why this is happening.
Any feedback regarding it would be appreciated.

Also here is my project.!/test-project2

Packages that you install through the console get removed when you run refresh, because we only keep the packages specified in package.json. You have to either edit package.json directly, or use npm i --save <package-to-install>. Then you can use refresh :slight_smile:

I think you didnt notice one of my point,
i.e. one package gets removed when next one gets installed
and let me tell one thing I missed earlier
the deps are listed in package.json

  "dependencies": {
    "discord.js": "github:hydrabolt/discord.js",
    "express": "^4.16.2",
    "klasa": "github:dirigeants/klasa"

And also the npm i --save <package> didnt work at all.

Ohhh sorry! This is really strange. It looks like a problem with npm prune (we run it after npm install). I tried it on my local machine (outside of Glitch), and it has the same behavior, so it is not Glitch specific. For some reason, it removes those two dependencies! The only way I found to solve this issue is to use a version instead:

  "dependencies": {
    "discord.js": "^11.3.0",
    "express": "^4.16.2",
    "klasa": "^0.4.0"

If you use this set of dependencies, it should work :slight_smile:

Sorry for the inconvenience! If you really need to use the github url, you should open a bug report on the npm issue tracker.

Ah thanks for the info, and sorry I hadnt tested this thing out in my local machine, but iirc one of my friend already uses github version for both the packages I specified, I need to verify this thing once though.

So I got confused.

Is there any chances you guys have a look around how you work with installing packages in glitch.
Becuase once while I was trying to update a package which I had required from github, even the peer dep package was removed.

And I am guessing something has gone wrong with how glitch parses packages.

Hi @Froosty,

Glitch doesn’t do any parsing of package.json, except for reading the start script and node version. The commands we run are npm install, followed by npm prune.

Is this issue back,
I am happening to get this error with my project again.

It was working fine few days back.

@Froosty what’s your project?

dexter-final but its a private project.

do you allow me to access it anyway?