Manually installing NPM packages - node.js

I used the node windows installer v0.8.3 to install nodejs.
When I try to install express like this:
npm install express
It's not working. I think that is because my company is using a proxy, so I downloaded express from github https://github.com/visionmedia/express, but I don't know how to install.
I unzip the file and put them in F/express/. Please help me? I'm on Windows
When I try to install from F:/express/ using the following commands
cd F:/express
npm install ./express
or
npm install .
I get the following error:
error: connect ETIMEDOUT
at errnoException (net.js:776:11)
at Object.afterConnect [as oncomplete] (net.js:767:19)
And when when I try to do
npm install F:/express
It shows
express#3.0.0beta7 prepublish F:/express/
npm prune
followed by lots of http get messages and then the same error

express itself has a lot of dependencies which I believe npm also tries to retrieve if you issue npm install. I think you should just configure proxy properly => http://jjasonclark.com/how-to-setup-node-behind-web-proxy?

It would probably be most convenient long-term to configure NPM to use the aforementioned proxy through one of the following methods (In the following, replace $PROXY with your proxy in the form $PROTOCOL://$DOMAIN:$PORT (e.g. http://proxy.server:80))
A. Set the environment variables http_proxy and https_proxy to $PROXY
B.
npm set proxy $PROXY
npm set https-proxy $PROXY

If you have trouble getting packages because of a proxy or other internet connection problem then set up the project on another machine. Then copy the project over to your target. It will have all the files that you need.

Try npm install .\express (assuming the express folder is in the current folder).
The problem is that express in npm install express is parsed as a package name, while .\express in npm install .\express is parsed as a folder name.

You will want to run npm install . from within your F:/express/ folder (or npm install -g . for a global install).
It looks like you downloaded beta version (3.0.0beta7). Try installing the latest stable version (2.5.11):
npm install https://github.com/visionmedia/express/tarball/2.5.11

Related

Not able to install cypress on windows 10

Above is the attached picture of the problem I got. I have installed Nodejs and run npm install command to create a package.json file in the cypress folder but was still not able to install it.
Try this
npm config set registry http://registry.npmjs.org/
so that npm requests for http url instead of https.
and then try the same npm install command
clear your cache by doing npm cache clean.
NOTE can lead to a security problem since https is not used here. I don't recommend to use this on production.
If the above mentioned doesn't work:-
1)ping registry.npmjs.org
2)I was able to solve this by running the following command:
npm config delete proxy
npm config delete http-proxy
npm config delete https-proxy
If this method did not work, disabling your router's firewall would solve the issue immediately.
ETIMEDOUT Error while installing Node packages on Windows
Please follow the below steps to fix,
npm config set proxy false
npm cache clean --force
npm install cypress
Hope it will fix your installation issue.
I'm also finding the npm install cypress command to be not working.
A workaround is to use npm install cypress#4.0.1.

Error while installing gulp-sass on windows

I creating my new web and this is the first time I'm using gulp and I have problems with the installation itself.
I used npm install gulp-sass --save-dev
and I got this
E:\WebPages\MyPage>npm install gulp-sass
> node-sass#3.13.1 install E:\WebPages\MyPage\node_modules\gulp-
sass\node_modules\node-sass
> node scripts/install.js
Downloading binary from https://github.com/sass/node-
sass/releases/download/v3.13.1/win32-x64-59_binding.node
Cannot download "https://github.com/sass/node-
sass/releases/download/v3.13.1/win32-x64-59_binding.node":
HTTP error 404 Not Found
Hint: If github.com is not accessible in your location
try setting a proxy via HTTP_PROXY, e.g.
export HTTP_PROXY=http://example.com:1234
or configure npm proxy via
npm config set proxy http://example.com:8080
Anyone knows how to fix this? Or how to install gulp-sass?
Thanks
Check if you have an updated version of node and npm running.
See https://github.com/sass/node-sass/issues/1911 for more possible solutions.

How can I install the latest version of Typescript without Internet (offline)?

I have Internet connection in my home and I can install the latest version of TypeScript with this command: npm install -g typescript , But unfortunately There is no Internet at my work place (in fact we are not allowed to use Internet).
Beside this I googled But It seems There is no offline installer for Typescript. My question is how can I handle this problem ?
I am totally new to npm and a step by step workaround would be appreciated .
There is an ugly solution: do npm install at home and copy the content of your globally installed packages folder to work.
If you want to be able to do npm install without access to the internet you will need to configure your own npm registry in your local network.
I've used Sinopia in the past when working offline. It works as a cache for npm allowing you to work off-line provided you have installed the required packages while having an internet connection.
As per https://www.npmjs.com/package/sinopia#installation you can install and configure Sinopia with the following steps:
# installation and starting (application will create default
# config in config.yaml you can edit later)
$ npm install -g sinopia
$ sinopia
# npm configuration
$ npm set registry http://localhost:4873/
# if you use HTTPS, add an appropriate CA information
# ("null" means get CA list from OS)
$ npm set ca null

Node.js npm install ETIMEDOUT

I am trying to run a demo program.
As per the instruction I have to run the command npm install, which install all the dependencies but facing the problem as below
Try the following command, it changes the registry's protocol from https to http.
npm config set registry http://registry.npmjs.org/
Please try
npm config set proxy null
It worked for me on date I posted this.

locally installing node npm packages

I am accessing internet under the wifi network(cyberoam) provided by our college. Whenever I am trying to install any npm package I am getting error like:
npm ERR! If you are behind a proxy, please make sure that the
npm ERR! 'proxy' config is set properly. See: 'npm help config'
ECONNREFUSED
I haven't set up any proxies on my Linux machine then also I'm getting error like this.
Is there any way to install those packages locally i.e how can I use them directly without installing them as npm packages.
Yes it is possible but I usually don't do that. For a quick and dirty solution:
Search for the packages repos in github
Checkout them to your local machine
And copy each one to the ./node_modules directory inside your node.js application folder.
In the future I certainly recommend you to use npm instead.

Resources