How can I run "msnodesqlv8" on a computer without internet - node.js

I have a Node.js API on a Windows computer without internet access and I need to access data from a Microsoft SQL Server database. I have the module "mssql" however I need to use Windows authentication. I found online that this method requires the module "msnodesqlv8," however when I install the module on an internet-connected device and then move the files onto the non-internet device, the module won't run. The error I receive when I run the API indicates that the module needs to be rebuilt. Whenever I run "npm rebuild," the build attempts to install the dependencies - which of course is not possible without internet.
To try to circumvent this issue, I removed the dependency list prior to rebuild, but the rebuild still snags trying to install "safe-buffer." I don't know where this install is getting triggered. When I search for "safe-buffer" in the project, no references to "safe-buffer" are found. My assumption is that a dependency is trying to use it and I have not skimmed through every dependency yet.
I also tried packing the "msnodesqlv8" module, then installing it from the .tgz file, but this produced the same errors.
One avenue I have not yet tried is packing the module on the internet device, then transerfing the .tgz file.
Any recommendations would be awesome - I am blocked until I can solve this issue.

I was able to solve this problem by downloading a prebuild from the Github releases. I noticed in the stack trace of the rebuild that the process was accessing a specific build from this link, so I moved it into the "prebuilds" folder where it was expecting it, and the module powered up on the next rebuild.
This process has to be replicated on every device, from workstation to servers, but it works. Just make sure you download the build that matches your system.

Related

I'm afraid I've installed a scam npm package: how to analyse a Wasm?

I've installed and executed (with nodejs) a package from npm: https://www.npmjs.com/package/openssl.js
Somehow I didn't realize that it hasn't a good reputation (almost no activity/stars on twitter, github). Now I'm afraid that it is a scam. The worst case would be that is stealing/encrypting my data or something like that.
I've checked the processes, I/O and network in the activity monitor but nothing interesting.
But I would like to have more confidence that everything is okay.
Since it is a Wasm file I cannot just check the source code.
I've tried to decompile with this tool: https://github.com/WebAssembly/wabt but it gives me for all binaries in that project this error: error: #0x00000004: bad magic value.
Maybe because in the README of the openssl.js package they claim it is build with wasienv toolchain?
Another idea would be install a honeypot and run the same commands in the honeypot. But which honeypot is suitable for this?
// edit
I was able to run wasm2c on this file: src/raw-wasm/openssl.wasm.
But how can I ensure there was no network interactivity?
Here are the first lines of the output: https://pastebin.com/YYHecFAC

Node packages error after migrating project to different folder

Using Angular with an ASP.NET MVC project and ive moved the codebase to another path on my hard drive. When I build, I get errors complaining about not being able to find packages. I dont think this is so much of an Angular issue (using System.js module loader), but rather a Node issue related to finding packages.
The fix so far has been to simply delete everything in node_modules and get them again. Is there a way to avoid having to do this? Otherwise, if I check my code into our source control system and someone else pulls it down, they will run into this issue as well.
[update]
When I am making a copy of the project, it includes the node_modules as well. I intend to check in these into source control as well, so that we can control when packages get updated and the dependency issues that might be caused.
[update 2]
Well I think I need to go back and review what Im doing. I never liked the idea of keeping node_modules in source to begin with and if I can find a way to manage "breaking changes" due to package updates, then I can forego the mess and bloat from keeping node_modules in my source control system.
https://www.sitepoint.com/beginners-guide-node-package-manager/
When someone else pull the code or when you move your code in other folder YOU HAVE TO RUN A NPM NISTALL command .. so it can download the packages ..
if you have already downloded them ..don't worry to do a NPM INSTALL cause it takes them from the cache ....
for other people they need first time to download them for first time
Hope it helps you!!

Move node_modules for other computer without network access

In this case,
I have one Project with some Packages and Dependencies (Nodejs). I use NPM for manager.
My client created one Web Server VM for me, without network access, just one Rule on the firewall to I can call my API.
I need some way to my project works perfectly inside my client, but my VM inside my client don't have network access.
I searched about this on Google, but every solve results have to install other dependencies, and I need something like copy and paste for my application will execute perfectly.
I saw this dependencies, but, I'm not sure if I need to install the dependencies inside my client for get my Packages from node_modules for my application to work well.
I saw: npmbox, yarn, npm-offline.
If someone use and know how to do that, please help me.
If have another way to do solved, I would like to hear.

Importing Go packages locally rather than remotely

In a node.js project, I'm using Go for a critical part of it that node isn't adequate enough to handle. I want to split the Go code into a sockets package and a main package, with sockets containing required structs/interfaces for the main package to run. The problem I'm having is that from what I can gather from Go's documentation, I can only use external packages like sockets remotely from github/gopkg. I don't want to split the repository for the project into one containing the Go code and one containing node's. How can I make the sockets package available for main to import locally while making it possible to rebuild the binaries for the two packages if any updates to their source code are made?
Edit: importing the packages is no longer an issue, but rebuilding packages on update still remains
It happens the same to my team too and we end up using vendor it's pretty easy to manage all the external packages. So, whoever checkout your repo will have all the packages inside vendor.
Understanding and using the vendor folder
And Please refer this site lots of other option out there too:
Golang Package Management Tools

How could I download many NPM modules without npm install?

Okay, so I get it that I might be looking for a totally unexpected behavior.
My current company has nothing for me to do for a few weeks, so I would like to start a side project. The problem is, the firewall is really strong here, so I cannot download anything with Git or Npm. I also am not allowed to do any request to the IT support, since I am not in my company's office but some offices owned by a client (that applies said strict policy). In short, I am stuck with firewall and proxy policies that I cannot modify.
I may download a module's zipped archive through the browser, and install it from there. However, it has multiple dependencies, that themselves have dependencies, and so forth. And since I cannot run npm install to retrieve the dependencies, I'm stuck.
I saw multiple possible solutions in order to solve those dependencies issues:
make NPM run all requests and downloads through the browser, since browsers are allowed to access to the network. I don't see any options for that so far.
Download all required dependencies as tarball and step-by-step install each of them. Because of the potential number of dependencies being huge, I am looking for a huge bulk of modules commonly used to download once.
Most solutions I find make the assumption that I may use npm install properly, while my proxy doesn't allow it.
I wouldn't like to spend days on Chrome's built in game. Any idea?
maybe you can create the project somewhere else, and then "import" it on your office local machine:
npm init
edit package.json with your dependecies
npm install
put everything on usb stick and put it on your local computer at work.
or
send an archive of the code via email and download the tarball from email at office.

Resources