I'm trying to connect to a database on Azure using node-mssql. My development system is Windows 7 and I have had no success at all getting node-sqlserver to install via WebMatrix.
My question is two part: Firstly is there any reason that even when I follow the instructions from Microsoft that I get errors with node-sqlserver? Trying the naive approach using NPM inside WebMatrix I get the following error:
An error occurred.
"C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "node-sqlserver" "--json"
Exit status 1
Failed at the node-sqlserver#0.1.0 install script.
This is most likely a problem with the node-sqlserver package,
not with npm itself.
Tell the author that this fails on your system:
node-gyp rebuild
You can get their info via:
npm owner ls node-sqlserver
There is likely additional logging output above.
Failed: npm reported an error.
NodeNpm.NpmException: Failed: npm reported an error.
at NodeNpm.NpmApi.Install(INpmPackage package)
at Microsoft.WebMatrix.NpmGallery.CachingPackageManger.InstallPackage(INpmPackage package)
at Microsoft.WebMatrix.NpmGallery.PackageViewModel.Install()
at System.Threading.Tasks.Task.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
The machine has VS2012 Professional installed.
The second part of my question is, is there any reason why using node-mssql won't work under Azure? I simply get a failed connection error, even though I've verified the details several times (substituted placeholders for actual values below):
var config = {
user: '{username}',
password: '{password}',
server: 'tcp:{server}.database.windows.net',
database: '{database}'
}
I get the following error:
{"name":"ConnectionError","message":"connection to tcp:{server}.database.windows.net:1433 >- failed Error: getaddrinfo ENOTFOUND"}
I realise that node-sqlserver is the best way to do it under Azure but I've tried for a couple of days with no success. Is there anything obvious I am missing?
1) You can solve it by downloading precompiled node-sqlserver driver from this repo. I was not able to compile sources on my machine even with all dev dependencies installed as well.
2) node-mssql module use three different drivers to communicate with sql server. Your config doesn't specify any driver, so the default one is used - Tedious. You must change your config to make it work correctly:
var config = {
user: '{username}',
password: '{password}',
server: '{server}.database.windows.net', // simply remove "tcp:"
database: '{database}'
}
There is also an option to use node-mssql with node-sqlserver but to make it work, you have to install compiled node-sqlserver driver manually. Config should look like this:
var config = {
driver: 'msnodesql',
user: '{username}',
password: '{password}',
server: 'tcp:{server}.database.windows.net',
database: '{database}'
}
I was using SQL Azure from Node.js last year when the module was named node-sqlserver so my answer might not work.
Ref your first problem, node-mssql should need to be compiled through node-gyp and C++ during NPM installation. So you'd better check if you have C++ compiler installed. When I was installing it told me I need VS2010 C++. Not sure if you need it now, or any later version. You can run npm install node-mssql from command window and you should get a log file if it failed, should be npm-error.log or something similar.
Ref your second problem, when I was using this module I use connection string. Could you double check your username was specified in format user#server. Also double check if your SQL Azure firewall was opened for other cloud services.
Related
Using the following installation on Ubuntu Server 20.04 :
sudo apt-get update
sudo apt-get install nodejs
sudo apt install python2
sudo apt install npm
npm install ganache-cli
npm install node-gyp#3.6.2
npm install truffle#5.1.39
sudo npm install create-react-app#3.3.1 -global
npm install
I am having the error
Failed to load resource: net::ERR_CONNECTION_REFUSED 127.0.0.1:8545/:1
I am running ganache with the command line interface:
I can test the connection via node command prompt
To which I am able to verify a connection to ganache private blockchain
Then I try App.js in React
obtaining the following error:
I have tried the following:
1.) Setting up a proxy under package.json : http://127.0.0.1:8545
2.) Trying http://0.0.0.0:8545
3.) Setting up a middleware proxy account as presented in the following solution:
https://medium.com/bb-tutorials-and-thoughts/react-how-to-proxy-to-backend-server-5588a9e0347
"proxy": "http://127.0.0.1:8545"
4.) addressing cache related issues through rm -r package-lock.json node_modules and npm install updating react.js to latest version
5.) trying different port: 7545
6.) updating react to latest version on ubuntu
I figured it out - thanks to all who reviewed my problem. - hopefully this will help someone in the same situation. To connect to an ec2 instance with React.js / blockchain dapp you need to follow five steps:
1.) set appropriate security rules (you will need to allow access for an instance to reach your server) I set the following rules in a very liberal fashion since this was only a test:
you need to start ganache with explicit chainId specified and a direct reference to your public domain IPv4 DNS domain e.g (
http://ec2-54-186-149-26.us-west-2.compute.amazonaws.com)
the command should look as follows:
3.) the same domain mnemonic needs to be specified in metamask (along with an imported account from your ganache server ) It should look as follows:
4.) React.js also needs to access the domain from EC2 directly (do not use localhost ,even you are running on the server the loopback will not work! - also do not use a shortcut with or (||) condition as that also produced errors for me ). It should look similar to below:
5.) your smart contracts also need this domain specified explicitly - so you will also need to edit your truffle-config.js as follows:
Finally i can read my blockchain via React.js on a test network (ganache) via EC2.
Below is blockchain data presented to screen.
I hope this helps someone out there - this was not found easily.
regards
John D.
Not able to install msnodesqlv8 on linux. I get this error when I'm trying to test my connection on Linux Server. Getting the below error.
Unsupported platform for msnodesqlv8#0.4.5: Wanted {"os":"win32", "arch":"any"} (Current:{"OS":"linux","arch":"x64"
Could you please give a work around for this.
I'm using that way
const sql = require("mssql/msnodesqlv8");
I am facing this issue in jenkins when i run bower install --allow-root. The build fails displaying the following error:
Failed to execute "git ls-remote --tags --heads
https://github.com/gabelerner/canvg.git
final build failure error displays as follows:
fatal: unable to access 'https://github.com/gabelerner/canvg.git/': Peer reports incompatible or unsupported protocol version
It shows the same error with different GIT file paths.
Previous error was :
Error fetching remote repo 'origin'
which we solved changing the SSH key.
If we remove bower install command from the build, the build is successful.
Any help would be appreciated.
This may be the reason to your problem:
Discontinue support for weak cryptographic standards
....As a result, GitHub is announcing the immediate deprecation, and
eventual disablement, of our use of the following cryptographic
standards:
TLSv1/TLSv1.1 - This applies to all HTTPS connections, including web,
API, and git connections to https://github.com and
https://api.github.com. diffie-hellman-group1-sha1 - This applies to
all SSH connections to github.com. diffie-hellman-group14-sha1 - This
applies to all SSH connections to github.com. All of the above will be
disabled on February 1, 2018.
so you need to upgrade to stronger ciphers.
I see that this solution helped others
github-unable-to-access-ssl-connect-error
yum update -y nss curl libcurl
I hope this helps
fatal: unable to access 'https://github.com/john/git-Training.git/': Peer reports incompatible or unsupported protocol version.
I upgraded to the newest cipher, the fatal error was gone.
[john#doe git-Training]$ sudo yum update -y nss curl libcurl
I'm running npm to install msnodesql, an npm library for sql server drivers. I am installing this on a Windows Server 2012 box.
I have installed Visual C++ 2010, node-gyp and Python 2.7.x.x as dependencies, and all of these installs were successful.
When I run npm install msnodesql, I get a big red error:
(x86)\MSBuild\Microsoft.Cpp\v4.0\Miscrosoft.Cpp.InvalidPlatform.Targets(23,7):
error MSB8007: The Platform for project 'sqlserver.vcxproj' is
invalid. Platform='x64'. You may be seeing this message because you
are trying to build a project without a solution file, and have
specified a non-default Platform that doesn't exist for this project.
My box is 64-bit. Not too experienced in this stuff at all, so though it looks like a platform error, i'm really not sure what to do.
Help!
I got the same error. Turns out I needed to remove my installed node.js (64 bit) and download 32-bit node.js instead. Once I did this I ran node-gyp configure, then node-gyp build with no errors.
I'm trying to run the build script from HTML5 Boilerplate and I have to install YUM for that. I am on Mac OS Snow Leopard 10.6.8. When I did sudo port install yum, i'm getting the following error. Any idea how can I rectify it and install yum properly?
---> Computing dependencies for py24-nose
---> Dependencies to be installed: py24-distribute
---> Activating py24-distribute #0.6.24_0 Error: Target org.macports.activate returned: Image error:
/opt/local/lib/python2.4/site-packages/setuptools-0.6c11-py2.4.egg-info
already exists and does not belong to a registered port. Unable to
activate port py24-distribute. Use 'port -f activate py24-distribute'
to force the activation. Error: Failed to install py24-distribute Log
for py24-distribute is at:
/opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_ports_python_py-distribute/py24-distribute/main.log
Error: The following dependencies were not installed: py24-distribute
Error: Unable to upgrade port: 1 Error: Unable to execute port:
upgrade py24-nose failed To report a bug, see
<http://guide.macports.org/#project.tickets>
Previously after installing YUM, i was getting Segmentation Fault, so I uninstalled and installed it again using Macports to get the above error.
I think you've got the wrong end of the stick here. You do not need to install YUM on the Mac. In fact, that act is sheer madness, because you already have a perfectly good package manager in the shape of MacPorts!
Read again what it says
If you're on Mac or Linux...
You've got all your dependencies pre-installed, likely. You may need a yum install ant-contrib or what have you.
The key bit there is "or what have you". That is a cryptic way of saying "or the equivalent command for your package manager". On Red Hat-based systems, the package manager is indeed YUM; on Debian systems, it's APT; on the Mac, it's MacPorts.
So, remove your YUM installation, and simply do:
port install ant-contrib
You can now proceed to actually running Ant.