Javascript Development for Fedora

This post will show how to install node.js and npm from github repositories. Then typescript will be installed.

First thing clone repo from node.js

git clone https://github.com/nodejs/node.git 

Then, as per instructions to build run ./configure and the make -j4

Prerequisites are python, gcc and make.

This will create node command. What is not clear is how npm is inside this distro.

node pre-release

npm is the package manager and it is only a js file run by node. This is included in node distribution,

npm client

but there is also a npm github site. What I found is that only documentation is built with npm git repository.

git clone https://github.com/npm/cli.gi

However, I used this command to install npm:

curl -L https://www.npmjs.com/install.sh | sh

Once I built node binary I copied to my ~/bin folder and then to my path.

npm uses 2 locations to set up libraries. Global and local. I’m new to node so I understood that local is project specific. In the other side, global it means only one path.

For instance, from my own build, global is set to:

Global prefix

In this prefix main modules should be installed:

npm global modules

Finally to install typescript use npm to install it. In this sample, I’m using npm from GitHub Repo. This is pointing to different global prefix.

npm from node npm_cli ..

This is weird. I think I’ll use npm version I installed with curl.

In an additional note, npm from Git repo did not work at all. I had to change npm script to fix path issue with npm_cli.js. Once I did that change npm worked:

I changed these lines from npm file:

18 ###NPM_CLI_JS="$basedir/node_modules/npm/bin/npm-cli.js"
19 NPM_CLI_JS="$basedir/npm-cli.js

Anyway, tsc is ready to run typescript files.

Leave a Reply

Your email address will not be published. Required fields are marked *