Error: CERT_UNTRUSTED while trying to install Node-Red - node.js

When i try to install Node-Red with
sudo npm install -g --unsafe-perm node-red
i get an Error:
GET https://registry.npmjs.org/node-red
GET https://registry.npmjs.org/node-red
GET https://registry.npmjs.org/node-red
Error: CERT_UNTRUSTED
at TLSSocket.<anonymous> (_tls_wrap.js:644:36)
at TLSSocket.EventEmitter.emit (events.js:100:17)
at TLSSocket._finishInit (_tls_wrap.js:275:8)
If you need help, you may report this log at:
<http://github.com/isaacs/npm/issues>
or email it to:
<npm-#googlegroups.com>
System Linux 3.14.60-fslc-imx6-sr
command "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "--unsafe-perm" "node-red"
cwd /home/debian
node -v v0.11.7
npm -v 1.3.8
Additional logging details can be found in:
/home/debian/npm-debug.lgo
not ok code 0
Btw. the versions of node and npm seems to be wrong, i have node v10.13.0 and npm 6.4.1
although in the error message it shows something else (?)

Related

Error running npm install, returns This is a bug in `node-gyp`

I am new to Angular and Node. I am trying to execute an project created using Angular, Neo4j.
At first, I tried to run it as it is. However, i am givem the following error after opening the browser:
NullInjectorError: StaticInjectorError(AppModule)[RouterScroller -> >ViewportScroller]:
StaticInjectorError(Platform: core)[RouterScroller -> ViewportScroller]:
NullInjectorError: No provider for ViewportScroller!
ERROR Error: Uncaught (in promise): Neo4jError: WebSocket connection failure. Due to security constraints in your web browser, the reason for the failure is not available to this Neo4j Driver. Please use your browsers development console to determine the root cause of the failure. Common reasons include the database being unavailable, using the wrong connection URL or temporary network problems. If you have enabled encryption, ensure your browser is configured to trust the certificate Neo4j is configured to use. WebSocket readyState is: 3
Neo4jError: WebSocket connection failure. Due to security constraints in your web browser, the reason for the failure is not available to this Neo4j Driver. Please use your browsers development console to determine the root cause of the failure. Common reasons include the database being unavailable, using the wrong connection URL or temporary network problems. If you have enabled encryption, ensure your browser is configured to trust the certificate Neo4j is configured to use. WebSocket readyState is: 3
Then, I tried an clean install following this process:
Delete the node_modules from project;
Run npm install --global windows-build-tools
Run npm install
Then i am given this error:
gyp ERR! UNCAUGHT EXCEPTION
gyp ERR! stack Error: spawn C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\15.0\Bin\MSBuild.exe ENOENT
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:269:19)
gyp ERR! stack at onErrorNT (internal/child_process.js:465:16)
gyp ERR! stack at processTicksAndRejections (internal/process/task_queues.js:80:21)
gyp ERR! System Windows_NT 10.0.19041
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\USER_NAME\\PROJECT\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd C:\Users\USER_NAME\PROJECT\node_modules\node-sass
gyp ERR! node -v v14.15.1
gyp ERR! node-gyp -v v3.8.0
gyp ERR! This is a bug in `node-gyp`.
gyp ERR! Try to update node-gyp and file an Issue if it does not help:
gyp ERR! <https://github.com/nodejs/node-gyp/issues>
Sorry for the wall of text. Any suggestions to solve this problem?
Edit:
I've also tried the following:
Rebuilding the node-gyp bindings by running node-gyp rebuild, however that returns the following error:
binding.gyp not found while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! System Windows_NT 10.0.19041
gyp ERR! node -v v14.15.1 gyp ERR! node-gyp -v v7.1.2
I can confirm that node-gyp is installed globally because I ran: npm install -g node-gyp
I tried the gyp rebuild using python 2.7.18 to no avail. Still returning the same error.
Edit 2:
I no longer have access to the project. So I cannot test any new solutions pointed.
Regardless, Thank you guys for the help.
This is a known canvas issue, probably caused by missing native libs.
Try this see if it helps:
sudo npm uninstall -g node-gyp
sudo npm install -g node-gyp
brew install pkg-config cairo libpng jpeg giflib
npm i canvas
For me this was solved by using Node Version 14
tested with docker first docker pull node:14.10.0

Unable to verify the first certificate (grpc/node)

For some background, I am following along with this tutorial, trying to get the node example working.
I have downloaded the folder, cd'd into the directory, and tried to run npm install.
I get the following stack trace.
npm WARN package.json grpc-examples#0.1.0 No repository field.
npm WARN package.json grpc-examples#0.1.0 No license field.
\
> grpc#1.12.2 install /tmp/grpc/examples/node/node_modules/grpc
> node-pre-gyp install --fallback-to-build --library=static_library
node-pre-gyp WARN Tried to download(400): https://storage.googleapis.com/grpc-precompiled-binaries/node/grpc/v1.12.2/node-v46-linux-x64-glibc.tar.gz
node-pre-gyp WARN Pre-built binaries not found for grpc#1.12.2 and node#4.5.0 (node-v46 ABI, glibc) (falling back to source compile with node-gyp)
gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: unable to verify the first certificate
gyp ERR! stack at Error (native)
gyp ERR! stack at TLSSocket.<anonymous> (_tls_wrap.js:1022:38)
gyp ERR! stack at emitNone (events.js:67:13)
gyp ERR! stack at TLSSocket.emit (events.js:166:7)
gyp ERR! stack at TLSSocket._init.ssl.onclienthello.ssl.oncertcb.TLSSocket._finishInit (_tls_wrap.js:586:8)
gyp ERR! stack at TLSWrap.ssl.onclienthello.ssl.oncertcb.ssl.onnewsession.ssl.onhandshakedone (_tls_wrap.js:428:38)
gyp ERR! System Linux 4.8.13-100.fc23.x86_64
gyp ERR! command "/home/nbkiq0w/.nvm/versions/node/v4.5.0/bin/node" "/home/nbkiq0w/.nvm/versions/node/v4.5.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--libr$ry=static_library" "--module=/tmp/grpc/examples/node/node_modules/grpc/src/node/extension_binary/node-v46-linux-x64-glibc/grpc_node.node" "--module_name=grpc_node" "--module_path=/tmp/grpc/examples/node/node_mo$ules/grpc/src/node/extension_binary/node-v46-linux-x64-glibc" "--node_abi_napi=node-v46"
There's a bit more to the stack trace, but I think this gets the gist of it.
Unable to verify the first certificate
seems relevant here.
I googled a bit and found this, which seems to address my issue. I modified the example source code,
examples/node/dynamic_codegen/greeter_server.js
So it now has the following added to the top of the existing file.
var rootCas = require('ssl-root-cas/latest').create();
rootCas
.addFile('/etc/pki/ca-trust/source/anchors/amrs-g2.cer');
require('https').globalAgent.options.ca = rootCas;
In an attempt to follow this pattern. I am still seeing the same issue.
Anyone have any ideas? I should mention that I am running node version 4.5.0 and npm version 2.15.9.
I've tried messing around with the versions a bit, but can't get it working.
edit 1:
Tried updating node version to 10.0.0
Npm version 5.6.0
Tried the npm install again, this time got a weird error...
npm install
npm ERR! code E418
npm ERR! 418 I'm a teapot: async#^1.5.2
edit 2:
Tried running the command over and over, seems like the library it fails on is more or less random.
npm ERR! code E418
npm ERR! 418 I'm a teapot: grpc#^1.0.0
^C
[nbkiq0w#localhost node]$ npm install
npm ERR! code E418
npm ERR! 418 I'm a teapot: google-protobuf#^3.0.0
^C
[nbkiq0w#localhost node]$ npm install
npm ERR! code E418
npm ERR! 418 I'm a teapot: lodash#^4.6.1
^C
[nbkiq0w#localhost node]$ npm install
npm ERR! code E418
npm ERR! 418 I'm a teapot: grpc#^1.0.0
^C
[nbkiq0w#localhost node]$ npm install
npm ERR! code E418
npm ERR! 418 I'm a teapot: lodash#^4.6.1
Seems like it just fails regardless of library, I tried updating my proxy settings like seen here. Doesn't seem to help.
edit 3:
switched back to node 6.12.0, and seeing the original tls error. One of my friends was able to download the node directory as is, and run on his machine (using 6.12.0), so it must be something isolated to my machine.
I found on another page some advice to adjust my .npmrc file found in my home directory. I added the following line
cafile=<my cert file>
And the npm install worked. I'm unsure why my friend's install worked, since he didn't even have this file, but this is good enough for the time being.

Error when installing log.io using npm

I am trying to install log.io following the instruction from https://github.com/NarrativeScience/Log.io. It suggests using npm install command.
npm install -g log.io
The error I am getting is like below. And I tried on both Mac OS and Ubuntu, both no luck. Can anyone help me?
> contextify#0.1.13 install /usr/local/lib/node_modules/log.io/node_modules/jquery/node_modules/contextify
> node-gyp rebuild
npm http GET https://registry.npmjs.org/cssstyle
npm http GET https://registry.npmjs.org/cssom
npm http 304 https://registry.npmjs.org/cssom
npm http 304 https://registry.npmjs.org/cssstyle
gyp: Call to 'node -e "require('nan')"' returned exit status 1. while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/share/node-gyp/lib/configure.js:431:16)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:797:12)
gyp ERR! System Linux 3.13.0-32-generic
gyp ERR! command "nodejs" "/usr/bin/node-gyp" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/log.io/node_modules/jquery/node_modules/contextify
gyp ERR! node -v v0.10.25
gyp ERR! node-gyp -v v0.10.10
gyp ERR! not ok
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian
npm ERR! Error: ENOENT, chown '/usr/local/lib/node_modules/log.io/node_modules/jquery/node_modules/jsdom/node_modules/request/README.md'
npm ERR! If you need help, you may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-#googlegroups.com>
...
Finally I found the problems.
Ubuntu
On Ubuntu 14.04, the default repository of apt-get for node is not nodejs itself, but ax25-node. This will generate a default command node in /usr/sbin/ and does nothing if you call node (which is called by npm during the installation). I removed this package and created a symlink between node and nodejs, finally solved the problem.
sudo apt-get autoremove node
sudo ln -s /usr/bin/nodejs /usr/bin/node
sudo npm install -g log.io
Mac OS
The error log is quite different from what I got from Ubuntu. After some googling about node-gyp installation failure, I found this issue, which led me to install the Xcode dev tools. Not sure why this happens but it seems there are some conflicts between homebrew and Xcode. Anyway, it finally works :-)
This looks like a race condition in an older version of npm. There have been a lot of improvements to npm -- especially around conflicts and race conditions during install -- since 1.4. Can you try updating your npm installation?
To update npm on Windows, follow the instructions here: https://github.com/npm/npm/wiki/Troubleshooting#upgrading-on-windows
If you still see the problem after updating npm, could you please upload your npm-debug.log as a gist http://gist.github.com? If possible, run npm with at least one -d flag to increase the logging level.
Thanks!
i create this install package...
http://tinyurl.com/kfnfng6
1 - download it
2 - untar it (tar -xvf install_log.io.tar)
3 - cd install_log.io
4 - sh install.sh
5 - enjoy!
This form is simple and quiet.. i hope help other users... What i do? simple.. download packages and dependencies , and put all in one package and create a script...
;)

not able to install npm without sudo

I've installed node into a custom directory in my home folder called local per these instructions : https://gist.github.com/isaacs/579814
I've added the location to my PATH and it seems to work fine. I cannot however seem to get npm to install without sudo. From what I can tell it is trying to execute a command in /bin folder.
The command I am running from ~/local/npm is make install and I got the latest versions of both node and npm from github.
Can anyone assist here?
user#localhost [~/local/npm]# make install
rm -rf \
.building_ronn \
html/doc \
html/api \
man
scripts/doc-build.sh doc/api/npm-view.md man/man3/npm-view.3
make[1]: Entering directory `/home1/extrabol/local/npm'
node cli.js install ronn --no-global
npm ERR! Error: EROFS, mkdir '/bin/node'
npm ERR! at Error (native)
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR! <http://github.com/npm/npm/issues>
npm ERR! System Linux 3.4.87-20140414.1.bh6.x86_64
npm ERR! command "node" "/home1/extrabol/local/npm/cli.js" "install" "ronn" "--no-global"
npm ERR! cwd /home1/extrabol/local/npm
npm ERR! node -v v0.11.14-pre
npm ERR! npm -v 1.4.10
npm ERR! path /bin/node
npm ERR! code EROFS
npm ERR! errno -30
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home1/extrabol/local/npm/npm-debug.log
npm ERR! not ok code 0
The Debug Log reports this
0 info it worked if it ends with ok
1 verbose cli [ 'node',
1 verbose cli '/home1/extrabol/local/npm/cli.js',
1 verbose cli 'install',
1 verbose cli 'ronn',
1 verbose cli '--no-global' ]
2 info using npm#1.4.10
3 info using node#v0.11.14-pre
4 verbose node symlink /home1/extrabol/local/node/node
5 error Error: EROFS, mkdir '/bin/node'
5 error at Error (native)
6 error If you need help, you may report this *entire* log,
6 error including the npm and node versions, at:
6 error <http://github.com/npm/npm/issues>
7 error System Linux 3.4.87-20140414.1.bh6.x86_64
8 error command "node" "/home1/extrabol/local/npm/cli.js" "install" "ronn" "--no-global"
9 error cwd /home1/extrabol/local/npm
10 error node -v v0.11.14-pre
11 error npm -v 1.4.10
12 error path /bin/node
13 error code EROFS
14 error errno -30
Figured it out. Looks like when I git cloned the npm files somehow I didn't have ownership over all of the files. a quick chown -R on the npm folder fixed the issue.

SSL Error: CERT_UNTRUSTED while using npm command

I am trying to install express framework using npm command but getting following error.
error message is
E:\myFindings\nodejs_programs\node>npm install -g express
npm http GET https://registry.npmjs.org/express
npm ERR! Error: SSL Error: CERT_UNTRUSTED
npm ERR! at ClientRequest.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\request\main.js:409:26)
npm ERR! at ClientRequest.g (events.js:185:14)
npm ERR! at ClientRequest.EventEmitter.emit (events.js:88:17)
npm ERR! at HTTPParser.parserOnIncomingClient [as onIncoming] (http.js:1445:7)
npm ERR! at HTTPParser.parserOnHeadersComplete [as onHeadersComplete] (http.js:111:23)
npm ERR! at CleartextStream.socketOnData [as ondata] (http.js:1356:20)
npm ERR! at CleartextStream.CryptoStream._push (tls.js:396:27)
npm ERR! at SecurePair.cycle (tls.js:751:20)
npm ERR! at EncryptedStream.CryptoStream.write (tls.js:131:13)
npm ERR! at Socket.ondata (stream.js:38:26)
npm ERR! [Error: SSL Error: CERT_UNTRUSTED]
npm ERR! You may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-#googlegroups.com>
npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "express"
npm ERR! cwd E:\myFindings\nodejs_programs\node
npm ERR! node -v v0.8.0
npm ERR! npm -v 1.1.32
npm ERR! message SSL Error: CERT_UNTRUSTED
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! E:\myFindings\nodejs_programs\node\npm-debug.log
npm ERR! not ok code 0
help me to sort out
You can bypass https using below commands:
npm config set strict-ssl false
or set the registry URL from https or http like below:
npm config set registry="http://registry.npmjs.org/"
However, Personally I believe bypassing https is not the real solution, but we can use it as a workaround.
npm ERR! node -v v0.8.0
npm ERR! npm -v 1.1.32
Update your node.js installation.The following commands should do it (from here):
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
Edit: okay, if you really have a good reason to run an ancient version of the software, npm set ca null will fix the issue. It happened, because built-in npm certificate has expired over the years.
I had same problem and finally I understood that my node version is old. For example, you can install the current active LTS node version in Ubuntu by the following steps:
sudo apt-get update
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
sudo apt-get install nodejs -y
Installation instructions for more versions and systems can be found in the following link:
https://github.com/nodesource/distributions/blob/master/README.md
I think I got the reason for the above error. It is the corporate proxy(virtual private network) provided in order to work in the client network. Without that connection I frequently faced the same problem be it maven build or npm install.
If you're behind a corporate proxy, try this setting for npm with your company's proxy:
npm --https-proxy=http://proxy.company.com install express -g
Since i stumbled on the post via google:
Try using npm ci it will be much than an npm install.
From the manual:
In short, the main differences between using npm install and npm ci are:
The project must have an existing package-lock.json or npm-shrinkwrap.json.
If dependencies in the package lock do not match those in package.json, npm ci will exit with an error, instead of updating the package lock.
npm ci can only install entire projects at a time: individual dependencies cannot be added with this command.
If a node_modules is already present, it will be automatically removed before npm ci begins its install.
It will never write to package.json or any of the package-locks: installs are essentially frozen.
Reinstall node, then update npm.
First I removed node
apt-get purge node
Then install node according to the distibution. Docs here .
Then
npm install npm#latest -g
Only recommended if you are running a very old version of node/npm where the certificates have expired or been replaced,
first run npm set ca null
then do your npm install

Resources