yarn installs different packages on different machines - node.js

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.

Related

nextjs has correct Content-Type header on Linux but wrong on MacOS

long story short:
using yarn
yarn, yarn build and yarn dev works
browser issues occurs on MacOS, Linux works fine
Browser issue is "wrong header for X-Content-Type" which might be:
actually a wrong header
wrong path
Why is this issue peculiar?
It occurs only on my machine and I tried to update the system, also downgrade the system and whatever I do, the issue is still there (currently downgraded from Ventura to Monterey and finally to Big Sur - so 2 major versions down)
People having same or different MacOS and version all basically said: works on my machine™
I tried big sur, monterey and ventura - nothing works, but just for me
tried on my old linux machine and it works fine as it should (this is personal so a lot of everything development-related tools etc. installed there)
OK, what's the actual issue about?
this is same nextjs app, pulled fresh from git master, yarn && yarn build && yarn dev
Linux:
MacOS:
It is not the OS, can't really pinpoint the issue and this is project that is using npm packages from private repo
Any ideas why that might be happening?
I tried to clear yarn and npm cache, different node versions via nvm, nuked os and made clean install several times (different versions of OS) to exclude possible macOS version related issues
basically what I was doing the whole time:
clean macOS installation
pulled from git master
yarn && yarn build passed fine
yarn dev passed OK
tried to run it but got this issues from below for each 404 file
The resource from “http://localhost:3000/_next/static/development/_buildManifest.js?ts=1676469549408” was blocked due to MIME type (“text/html”) mismatch (X-Content-Type-Options: nosniff).
I was expecting it to work on Mac same as it works on Linux, but it didn't.

How to install node + vue web program offline

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)

How to manage npm install in a system without internet connection

I am facing challenges while creating package for all the clientside components of my project in a system which does not have internet connection (for windows).
I have installed NPM for windows in the system. I need to manage the node_modules and run gulp commands in the system to create the package.
Since there is no internet connection in the box, I decided to copy the node_modules from my local box to the box which does not have internet connection.
For copy task, I am using msbuild script but somehow it is not working for me. Also, I see that when I am trying to copy the node_modules manual from one folder to another folder I am unable to copy.
Installed Node version : v0.12.2
NPM version: 2.7.4
Can anyone help me to provide any working sample to fix the above problem.
I think your approach is generally sound. You can build on the internet connected computer no problem! Copy files over with a usb stick if you like.
Here are some tips that might help solve your problems.
If the box is offline, develop on your local machine and deploy to the box
If possible do the gulp steps also on your local machine
Otherwise you need to run the local directory install of gulp. e.g.
node node_modules\gulp\bin\gulp.js build
because you won't be able to npm install -g gulp
Point 3 will work for other global npm_modules too btw
If you are facing long paths (> 256 characters) which can cause copy problems
Try using npm dedupe to remove duplicates
Or try copying to a shorter path e.g to c:\proj instead of to c:\very\long\path\proj
Or explicity install a dependency which has a long path
e.g
npm install deepdep#1.2.4
and then prune that folder from the original
rm node_modules\package\node_modules\package_with_too_many_nested_folders
Or Install the latest npm (v3.0 or higher) which solves this issue once and for all
e.g. npm install -g npm
which will build a much flatter hierarchy for your packages. Requires removing and reinstalling all packages.
Point 5 is a notorious issue on windows which is not a problem on linux because paths can be extremely long. (unless you are mounting a windows a windows directory from linux)
Personally I would go straight for the latest npm version but you have a number of ways of getting around the issue if this is not possible.

Installing and Upgrading Intern without NPM

Is there any way to install Intern without npm?
I'm not going to get the rights to download files through our corporate proxy and I can't convince anyone to spend a few dollars to upgrade to Artifactory Pro and use its npm support.
You could download it from GITHub [https://github.com/theintern/intern/releases/tag/2.2.2] at home, or on a computer of a friend (outside of the Proxy). But that are the sources which must be compiled. And even if you could download the node module then, there still be dependencies, which would have been resolved by hand. (npm could not add them automatically).
One idea is to put your project on a stick or external HD. Take it to Computer outside of the proxy. Install node on this computer. Install Intern and put it back to the work computer.

Installing an old version of Node.js on a Vagrant VM

I'm setting up a Vagrant environment for a client with some legacy dependencies that require Node.js v0.4.12. I know I can install it via nvm, but that's provisioning the box with NVM and starting the node app is proving...problematic. In a perfect world, I'd be able to install old versions via apt (apt-get install nodejs=0.4.12), but that doesn't seem to be an option. I can't find a single PPA that retains old versions.
I know I can pull and compile from source (that's where I'll go if I have to), but I'm wondering whether there are any other options I just haven't found. I also need npm.
For whatever it's worth, I ended up installing with nvm. There are still some minor issues to resolve like existing the provision script cleanly, but Node gets installed and started successfully so I guess that's the answer. At least for now.

Resources