How to install node + vue web program offline - node.js

Hey Im looking for a good and solid solution for how to install node + vuejs full stack web program in offline. Our customer can not have any internet access so we have to install it in offline but cant imagine how to do. First idea was copy all the code including node modules and just paste it to the customer’s computer and run it. However I do bot believe this is gonna work.
Customer uses Centos as fas as I know.
Thanks in advance.

Anyone who's looking for a 'how to' steps for offline centOS install.
Preparation
a laptop or Computer can access to the internet.
Install VM or whatever you want to use to set the whole project in CentOS
Install CentOS7 in your VM and connect to the internet.
!! Important!!
You MUST Follow your customer's centOS install options. There are many options you can select when you install your centOS. When you install your project in offline, you have to have all the packages(or dependencies) depends on OS installed options. If your customer installed CentOS as full development package, then you don't have to have additional dependencies. if not, you need a lot.
download all the packages you need as CentOS version. In my case, my web is based on 'Nodejs + Express', 'Vuejs + AntDesign', pm2, nginx so I have donwnloaded nodejs, nginx, and pm2. Others are gonna work without any problems once you've installed Nodejs. If you need some additional packages or dependencies(it will be written in the terminal message during installation process of node or others) then write down all the packages and install them.
Set your project in CentOS and test if it works(build the project if it's needed). If it does not work, check the path, dependencies, or anything else might be related(DO NOT FORGET LINUX AUTHORITY!!).
If everything works, then get all the installation file(.rpm) you've installed.
install another CentOS in VM as OFFLINE
install in offline CentOS .rpm installation files you get from online CentOS above.(no. 6) (DO Exactly same installation but this time, with only the files. not from the online repositories)
Test
If it's not working, check the path, root or user's authority in CentOS.
About PM2.
As PM2 is for the process management, you have to install it globally. However, sometimes(I tested 2 times in exactly same set environments. First try did work but second try didn't work. Couldn't find why. I've tested 4.3 and it works every time so I suggest you to get the pm2 version under 4.5) pm2 v.4.5 or up does not support offline installation with npm so All you have to do in online centos:
npm pack pm2(whatever you've set the name when you installed pm2 in online centos, if you didn't change the package name then npm pack pm2 will work, command path doesn't matter. pm2 is installed globally so when you run npm pack pm2 anywhere it will take global installed pm2 whatsoever) This will pack all the dependencies to install pm2 in offline. Take this packed file(.tgz) and install this in offline.
Test
If it's not working and you couldn't find the reason why, leave a comment or answers down below. I will try to help as much as I can.(I'm Korean and live in Korea. Please be aware of time difference)

Related

yarn installs different packages on different machines

I have some node project that uses yarn as the package manager, I have a windows 10 laptop and windows 10 PC, I'm able to install all the packages using yarn, but when trying to run the project it works on the laptop but fails on the PC(seems like some packages are not fully installed or something, but the yarn install does finish seemingly successfully).
I tried to match some parameters like node version, msvs version, windows SDK version, etc, but I just can't think of anything else that would cause this to happen.
I can't really share the project as it's not open source, but I'm just not sure about what could actually cause this to happen.
When installing the packages, on the PC it says that it installs 133073 files(or dependency linking), while on the laptop it says that it installs 134040 files. I believe this is where the difference is, also, if I run yarn install on the laptop and then just move the files to the PC, it works properly, I do need to get it working on the PC though.
Any advices or troubleshooting ideas would be very useful, thanks.

Does "npm install electron" also downloads chromium?

I'm trying to start the development of an electronJS app at my company, but I'm having a lot of trouble to install the framework by the command line "npm install electron". I have consulted the TI and our guess is that when running this the npm command, it tries to download chromium or other executables files and because of that our company proxy blocks the downloads of these files. I have installed chromium using a different way that is permitted by the proxy, so having chromium installed is not a problem. So summarizing I have two questions?
Is chromium really downloaded with "npm install electron"?
Is there any way I can install electronJS not using "npm install electron" or without downloading chromium?
I hope you can help me,
thanks
Note: I can't download any source code from github too
Yes, ElectronJS comes with Chromium. The application windows you see are Chromium instances.
It's also stated on their web page under "Web Technologies".
Electron uses Chromium and Node.js so you can build your app with HTML, CSS, and JavaScript.
Another place from which you can get it that they've provided on their GitHub page is CircleCI, but the website seems to require registration.
Tip: when you're installing ElectronJS, I recommend doing it as stated by the official guide -> npm install electron --save-dev and not just npm install electron. As to why, you can read the reason over here.
Another alternative is to download everything properly from somewhere else, e.g. your home, neighbour, café, etc., onto a USB Flash Drive and then when you get to your work place, have the IT department check the USB - once it's confirmed that it's safe, copy it to your work computer (make sure to consult with the apropriate department if you can do that).

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.

how come I have so many versions of nodejs?

how come I have so many versions of nodejs.
I have multiple of command prompts applications, I have
1. nodejs cmd
2. ubunto bash cmd
3. my normal cmd
and a bunch of others but I dont use them..
my question is.
1.how do I update my nodejs in my system and be just automatically reflected on all of my cmd's? is that even possible?
2. why is this happening?
3. what cmd should I use for running node applications?
below are the snapshots of cmds and the result that it gave me when I checked the version of node.
Right off the bat, I can tell you that the only nodejs package actually installed globally on your system is the first image you have shown (v6.10.2).
The second image (v6.11.2) came with the nodejs installer. So if you uninstall that application, you will not see it again. Check your PATH variable to make sure.
The third image (v4.2.6) is installed on WSL and therefore lives some place separate from the rest of your windows files and programs. You can use the command apt-get remove --purge nodejs to remove that one.
To answer your question, you cannot have the same nodejs across all systems because as you can see from my answer above, these versions of nodejs live in separate environments which are contained.
I would recommend using the nodejs installation from nodejs.org for running nodejs. This is the same as your second image.
Did you know windows has a package manager? Try chocolatey for managing node versions.
how do I update my nodejs in my system and be just automatically reflected on all of my cmd's?
why is this happening?
You can install node.js globally, you have different versions because you didn't install globally, so your cmds can't be automatically reflected. You can see this blog how to install node.js globally:
How To Install Node.js on Ubuntu 16.04
what cmd should I use for running node applications?
you can run node applications using cmd which you want, it doesn't matter.
You can use nvm to manage and easily switch between node's versions.

How to compile lesscss using node.js

Hi,
I have finished to code my website using lesscss client side and now want to compile less so I have donwloaded node.js. My website is running on localhost and I want first to know:
where I have to install node.js
what I have to do next ( commands lines tools, commands lines etc. ).
If someone can help me because I'm a newbie in this field.
Thanks.
You can install the LESS compiler directly from npm.
Install node.js. Go to this page and download the installer for your platform.
If you're on Windows, download the .msi; if you are on OSX, download the .pkg file. Whenever possible, download the 64-bit version (unless your system is running only 32-bit hardware and software). If you are on Linux and you want to use package managers, see this page.
Once you have node.js installed, you should also have npm, which is node.js Package Manager. You can open a terminal/console and run npm -v to make sure everything is installed correctly.
Eventually, you can install the LESS compiler by simply executing:
npm install -g less
(note: on OSX and Linux you may need to run this with sudo: sudo npm install -g less).
The LESS compiler will then be available as the lessc command. See examples here.
PS: Some GUIs also exist for simplifying working with lessc. Google "less gui windows/mac/linux" to see many results, like this one for Mac.
it's not mentioned what to do after installing node.js and installing less compiler on your node.
Go to your folder where you are hosting your project locally and then type styles. less styles.css. This should initiate the conversion from less to CSS at the node command prompt.

Resources