TFS cross platform CLI tfx-cli offline installation - node.js

I want to install tfx-cli on a machine which does not have access to Internet.
I have installed nodejs with node-v6.4.0-x64.msi.
Per msdn guide after installing node.js install tfx-cli with below command
npm install -g tfx-cli
But the above requires internet connection.
How to install tfx-cli in a machine which has no internet access.

Since you are using nodejs-v6.4.0. Afraid there is no way to install without internet access.
Certainly, there are some ways to use npm for offline pack installation. Such as offline-npm However it's not suitable for your case:
npm >= v3.x bundled with node >= v5 has broken this project.
preinstall script is since then called after requests to npm registry
are made. This makes it impossible for offline-npm to start as a
registry server.
And Use local-npm for offline NPM package installation, however you still should install many other things from internet. It doesn't make sense. If you have internet, you could directly install it.

Related

SPFx development setup offline

Is there anyway we can setup SharePoint framework development environment offline without internet connection?
Following this instruction,
https://learn.microsoft.com/en-us/sharepoint/dev/spfx/set-up-your-development-environment
It failed on the second step,
npm install -g yo gulp
If your node modules were already installed, then yes, you can develop offline. But the npm install command very specifically downloads and installs the package you specify.
If you can find a colleague who already has those modules installed and you can copy from their machine to yours, you could potentially get it setup without an internet connection, but you are going to have to get those SPFx packages (Yeoman Gulp and Microsoft Generator) from somewhere.

Is it necessay to update npm to update node?

I am new to npm and node so pardon if my question is silly, but is it necessary to update npm to its latest version if i want to update Node.js to its latest version? I read the npm wikipedia page and it says npm is a package manager for Node.js. Also, does npm provide a runtime environment for Node appications to work?
Node.js is the runtime (using the V8 JavaScript engine). Yes, npm is a package manager that helps include dependencies in the program, but it is not the only one. There are others like yarn, so npm is not essential to Node.js. There are several upgrade methods to choose from, using all the same installation methods typically available on operating systems. npm does not offer Node.js upgrades directly; options include node version manager and the npm-installable module n:
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
None of the methods mention an npm update, though it is a good idea to keep npm current for security. If a given upgrade method does require you to have a certain version of some manager or installer, you will get a message about it when trying to upgrade.

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

Unable to install Socket.IO disconnected from internet

I need to install Socket.io on a machine without internet access.
I've downloaded Node.js and Socket.IO on another box, but when I copy and try to install them on the isolated machine, Node.js installs ok, but Socket.IO insists on connect to GitHub.
How can I install Socket.IO without an internet connection? Should I install all dependencies offline? If so, what are the dependencies of Socket.IO?
It turns out that npm supports package caching. Basically you create a cache on the development machine that does have internet access, copy that cache onto your target at the same time that you install your nodejs application, and then install the packages from the cache. I assume from your question that the target machine already has nodejs and npm installed.
Step 1. Use npm to create a cache directory on your development machine
First, create a cache directory and configure npm to use it. Then install each of your packages.
mkdir ../my-cache
npm config set cache ../my-cache
npm install --save async#0.9.0
npm install --save restify#2.8.3
etc.
If you look in the my-cache directory you'll see sub-directories for each installed package.
Step 2. Copy the cache to your target machine along with your node application
No rocket science here: make sure you copy the my-cache directory to your target machine.
Step 3. Use npm to install the packages from the cache
Configure npm to use the cache directory. Be aware that npm will still try to go fetch the package files form the internet. And it will retry after a failure. I found a couple recommendations for forcing npm to use the cache, but those options did not work. But I did find a way to significantly reduce the amount of time npm spends trying to fetch before looking in the cache.
npm config set cache ../my-cache
npm config set fetch-retries 1
npm config set fetch-retry-maxtimeout 1
npm config set fetch-retry-mintimeout 1
npm install async#0.9.0
npm install restify#2.8.3
Be aware that you cannot just type npm install because npm will not use the cache. This is a bit of a pain. If you want a robust install you can write a tiny nodejs app to parse out the dependencies and calls child_process.exec to install each one.
(*) I should mention that there is a package called npm-cache (https://www.npmjs.com/package/npm-cache). In my case npm-cache did not suit my needs. But you may be able to make it work for you.

How to install nodejs modules on windows7?

I tried to install MySQL and Canvas2D modules on windows 7, but there are linux commands at the build instructions, for example make, and there are some shell scripts too. I'm clueless. I have no idea how to install them on windows 7.
Sorry, I'm not an expert programmer, just a beginner, and I just want to try out nodejs with mysql and canvas2d.
Thanks in advance,
Why not install with npm?
NodeJS comes with Node Package Manager, a simple manager that uses repositories on npmjs. It resolves dependencies, and no building is required.
npm install db-mysql
npm install canvas
I also suggest the mysql driver mysql instead of db-mysql.
npm install mysql
I found mysql to be easier to use.
Other commands you might want to know:
npm help
npm install
npm ls
npm update
npm link
npm publish
Getting canvas to work on Windows is generally difficult (you need to install Python, Visual Studio Express + hotfixes etc). PhantomJs works easily on Windows, but little support for mysql afaik.

Resources