2

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 .

amiramw
  • 506
  • 2
  • 10
siamak
  • 669
  • 1
  • 10
  • 28

2 Answers2

2

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.

amiramw
  • 506
  • 2
  • 10
  • could you please elaborate your answer ? You mean only copying and pasting the Target folder that you mentioned is enough ? for example should I apply any registry settings too or not ? ... – siamak Jun 18 '17 at 21:21
  • I think you don't need. For example in windows 10 if you copy paste your entire C:\Users\\AppData\Roaming\npm I believe it should work. – amiramw Jun 18 '17 at 21:23
1

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
Nick
  • 873
  • 1
  • 6
  • 7