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.
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
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
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:
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.
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.
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.