Homebrew Npm

Posted on  by admin

Homebrew’s package index. Also known as: node.js, [email protected], nodejs, npm Platform built on V8 to build network applications. If you're a Homebrew user and you installed node via Homebrew, there is a major philosophical issue with the way Homebrew and NPM work together. If you install node with Homebrew and then try to do npm update npm -g, you may see an error like this. With npm you can run npm update -g (which is standard practice) and it will update all global node modules, including npm itself. When this happens after homebrew installed npm it completely breaks npm so that it no longer functions at all (unless you use sudo every time, which obviously isn't ideal). The only way to fix it is to re-install npm. Installing npm with Homebrew never seemed to work properly but I never knew why. Now I still don't but have them installed:) I had to use SGD1953's tip and do 'sudo rm -rf /.npm' before installing npm.


In this tutorial we will learn to install PostgreSQL database on Mac using Homebrew.

Prerequisite

It is assumed that you have Homebrew installed on your Mac.

If you don't have Homebrew installed on your Mac then open Terminal and run the following command.

You can visit Homebrew official website https://brew.sh to learn more about it.

Once you have Homebrew (a.k.a. brew) installed on your machine you can run the following command in the Terminal to check the version.

To update run the following command.

Alright, time to install PostgreSQL on Mac.

Install PostgreSQL using Homebrew

In Terminal run the following command to install PostgreSQL on Mac using Homebrew.

Install Npm Mac Brew

We can check the version of PostgreSQL using the psql command.

Homebrew Npm

Start PostgreSQL

To start PostgreSQL run the following command in the Terminal.

We will get a similar output shown below.

Stop PostgreSQL

To stop PostgreSQL run the following command in the Terminal.

We will get a similar output.

Restart PostgreSQL

To restart PostgreSQL run the following command in the Terminal.

We will get a similar output as shown below.

Login to PostgreSQL database

By default we will get a database by the name postgres. So, to connect to it we will run the following command.

We will see the following output.

List all the users

To list all the users we use the du command.

List all the databases

To list all the databases run the l command.

Create a database

Homebrew Npm Software

To create a database run the following command. In the given example mydb is the name of the database.

Connect to a database

To connect to a database use the c command.

Homebrew Vs Npm

List all the tables inside a database

Homebrew Npm 6

To list all the tables inside a database we run the d command.

Note! If there is no table then we will get a prompt stating no relations found.

Let us go ahead and create a simple users table inside the mydb database and try the above command again.

Create table

In the following example we are creating a simple users table.

Homebrew npm download

Now if we list the tables using the d command we will get the table.

How to exit from psql?

To exit or quit from psql type the q command.

Alright, this brings us to the end of this tutorial. Hope you found it useful. Please share this tutorial if it was helpful. See you in the next tutorial. Have fun developing :-)