Can I install npm papckages directly in Glitch?

I need to use npm edit-distance package in a Botkit bot that I’m developing, but I don’t know how to do that in Glitch, is it possible? If not, what I have to do? Sorry, I’m a novice.

You can add it to package.json by editing the file, but the easiest way is to use the package search that you’ll see at the top of the window when you edit package.json.

1 Like

Oh great! Thanks a lot Tim!

Excuse me, what am I doing wrong?

Sorry, I’m a novice

(post withdrawn by author, will be automatically deleted in 24 hours unless flagged)

It looks like you have chosen a version of that library that doesn’t exist. If you go to Tools -> Logs in the lower left corner of the editor, you can see the error.

Yes I see.
But I did not choose the version, Glitch did it

Hi @RomanDubrovsky, I think you’re running into an issue with the 3rd party service we use to help manage the package list that you see in that dropdown. If you take a look at https://hilarious-monarch.glitch.me/?name=node-vk-bot-api&version=2.5.0 you can see that version 2.5 has been unpublished from NPM, but libraries.io still shows that as the most recent version.

In these cases you’ll need to manage the version manually - you can find the current version in npm’s version tab for the package.

Sorry for the inconvenience!

Thank you very much for help

Could you give an example of the correct “package.json”?

It looks to me like you’ve got a proper version of that package specified now; are you still running into problems?

Yes(

This code is already causing an error.

Hey @RomanDubrovsky I think you’re running a version of node that doesn’t support the JavaScript language features that package is looking for. I think if you remove the lines at https://glitch.com/edit/#!/exuberant-blackberry?path=package.json:11:0 calling out Node 6 you’ll probably have better luck, since your project will then use the default (Node 10) which should be better suited to what you’re working with there.

What should the “package.json” look like after that?