Uninstall NPM from Glitch Project


#1

Is there a way I can Uninstall npm and just use yarn I don’t like npm yarn is light weight and fast.


#2

@cori Can we reach some solution?


#3

Hello Mordo,

Installing Yarn

  • Click on “Logs” and a half-portal will open, click on “Console.”

  • Install Yarn by typing this: curl -o- -L https://yarnpkg.com/install.sh | bash

Installing a package

Starting a new project

  • Type yarn init to initialize your project with package.json

Installing a package or adding a dependencies
Latest version:

  • Type yarn add [package] and hit return.

Specific version:

  • Type yarn add [package]@[version] and hit return inside the console.

Removing a package

  • To remove a package, type yarn remove [package]`

For more info about removing a dependency: https://yarnpkg.com/lang/en/docs/cli/remove/


#4

Hey @Mordo, ( p )npm is central to how Glitch is architected and we have no plans to alter that for Node projects in the foreseeable future.

You might be able to use the undocumented custom app type with a glitch.json file instead of a package.json file to run your app. That would require handling all of the install and start functions yourself in hand-crafted shell commands or scripts instead of the simplified operations available in package.json. I don’t know of any projects that use that off the top of my head, but someone else may have done something similar.

In your container the contents of /opt/watcher/app-types and its subdirectories are where that work happens, so you might be able to piece something together from that.

Hope that helps!


#5

glitch.json how can i use that?


#7

Hey @Mordo sorry for the delay here. Glitch.json is basically the custom app version of package.json. It’s not documented anywhere (yet) but if you read through the scripts in the directory I linked you can see how we handle it.

A glitch.json is basically just like a package.json file and having glitch.json instead of package.json makes the project a custom project type instead of a node project type, and it executes whatever you put in the install and start scripts. You can see some examples in a little proof of concept for Kotlin that I threw together earlier this week (https://glitch.com/~kotlin-poc) and also in the project that handles new projects cloned from git repos (https://glitch.com/~clone-from-repo). The thing to keep in mind here is that you might need to do additional work in those scripts to get a node project up and running if you were trying to work around ( p )npm (using a glitch.json file).

If you’re having trouble with getting Yarn to work there are a couple of examples of that out there as well - not sure if you were running into problems with that or not.