Certification could not be validated (grpc/node)

As I delve into this tutorial for guidance, my aim is to successfully execute the node example.

After downloading the folder and navigating to the directory, I attempted running npm install.

Here is the stack trace that was generated.

npm WARN package.json <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="6c0b1e1c0f4109140d011c00091f2c5c425d425c">[email protected]</a> No repository field.
npm WARN package.json <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="d0b7a2a0b3fdb5a8b1bda0bcb5a390e0fee1fee0">[email protected]</a> No license field.
\
> <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="375045475477061906051905">[email protected]</a> 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 <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="1a7d686a795a2b342b283428">[email protected]</a> and <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="335d5c575673071d061d03">[email protected]</a> (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"

Although there are more details in the stack trace, this summary captures the main points.

Unable to verify the first certificate

This appears crucial to my issue at hand.

After some online search, I came across this, which seemed relevant. I made adjustments to the provided code snippet,

examples/node/dynamic_codegen/greeter_server.js

To include the following lines at the beginning of the 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;    

Following a pattern from this page. However, the issue persists despite these changes. Any suggestions or insights? It's worth noting that I am using node version 4.5.0 and npm version 2.15.9.

Despite some trial and error with versions, I haven't been able to resolve the situation.

Update 1:

Attempted updating node version to 10.0.0, Npm version 5.6.0

Ran npm install again, encountered an unusual error this time...

npm install
npm ERR! code E418
npm ERR! 418 I'm a teapot: async@^1.5.2

Update 2:

Repeating the command multiple times revealed inconsistent library failures.

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

The continual failures seem indiscriminate among libraries. I tried adjusting proxy settings as suggested here, but to no avail.

Update 3:

Switched back to node 6.12.0, encountering the original tls error. A friend successfully ran the same code on their machine (using 6.12.0), indicating that the issue may be specific to my setup.

Answer №1

After reading some suggestions on a different website, I decided to make changes to my .npmrc file located in the home directory. I included the following line:

cafile=<my certificate file>

Surprisingly, this adjustment allowed me to successfully complete the npm install process. It's strange that my friend managed to install without needing this file, but for now, I'll consider it a success.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Troubleshooting a node-gyp issue with Karma

Hi there! I'm facing an issue while trying to set up karma using npm. After fetching the packages, the terminal seems to hang on the final build error message. To install karma, run this command: npm install -g karma During installation, some conso ...

How can I pass an object into EJS templates from views in Express 3.x?

Currently, I am utilizing ejs templates in combination with node.js and express 3.x. Is there a way to display the data object that is passed into the view? Can it be achieved similar to this example in index.ejs: <%= dump(session) %> ...

What is the method to retrieve values passed to the next() function in Node.js?

For my current project, I am utilizing Node.js in combination with Express.js to develop the back-end. In middleware functions, next() is commonly used to progress through the chain until reaching the final app.VERB() function. My question is, at what poi ...

Sending data with React using POST request

Currently in my React application, I have a form that includes fields for username and password (with plans to add "confirm password" as well). When submitting the form, I need it to send JSON data containing the email and password in its body. The passwo ...

What is the process for using Discriminators, the Mongo DB API, and Mongoose to insert data into Cosmos DB?

Issue Overview I am currently facing a challenge in writing documents to my Cosmos DB using the Mongo DB API and Mongoose for Object Modeling. To optimize costs, I aim to store all documents in a single collection by utilizing Discriminators. The project ...

When using Lockdown.js with NPM, I encounter a blank file being returned

When using Lockdown.js for NPM, I encountered an issue where the command to generate the lockdown file resulted in an empty file. Here are the links for the dependencies: NPM lockdown git Here is a snippet from my package.json: { "name": "nw", "pri ...

What are some strategies to keep users from navigating back using the browser after signing up?

Currently, I'm implementing an authentication system in my Node.js application using passport. Everything seems to be working smoothly except for one issue - when I click the back button in the browser, it takes me back to the signup page. This is h ...

Allow Nest.js server to receive binary files in the request body

Is there a way to retrieve the uploaded binary file data from the browser? While the Nest.js server application functions correctly with Postman, it throws a 400 error when the request is sent from the Google Chrome/Angular application. Any ideas on how ...

Struggling to locate package despite successful installation

When attempting to execute expo optimize, an error message prompts the need for sharp-cli. Following the guidance, sharp-cli is installed as directed. To my dismay, the same error persists even after completing the installation step. $ npm install -g &l ...

I am currently experiencing issues with the app post feature as it is failing to generate any output

var express = require("express"); var app = express(); var bodyParser = require('body-parser'); var port = 3000; const fs = require('fs'); // establishing connection to MongoDB using Mongoose var mongoose = require("mongoose"); // Imp ...

Guide for configuring a proxy based on request hostname using http-proxy-middleware and express

I am struggling to set up a proxy using http-proxy-middleware and express. The setup involves mapping hostnames, for example: http://123.com >> http://localhost:3000/123 http://456.com >> http://localhost:3000/abc This is what I have at ...

Exploring the Contrasts: npm Jasmine versus Jasmine-Core Packages

Why do many projects choose to use core files only from https://www.npmjs.com/package/jasmine-core, which contains just the essentials? For example, https://angular.io/docs/ts/latest/guide/webpack.html. ...

What is the process for creating a MongoDB database on Heroku using MongoLab?

Utilizing Express.js and MongoLab, I have successfully implemented the Heroku setup for MongoDB in my production environment by adding this code snippet to my app.js file. //Mongo on Heroku Setup var mongo = require('mongodb'); var mongoUri = ...

The Azure website is encountering an issue due to the absence of the specified Node version in the

Within my Azure setup, I am currently using an 'Azure Website' instance to run Docpad (a NodeJS App). In my package.json file, I have specified the following... "engines": { "node": "0.10.21", "npm": "1.x" }, I have tried various entries ra ...

Is Your App at Risk? Detecting Slow Post Vulnerability in Express.js and Implementing a Data Rate Limitation Solution

I am currently tackling the Slow Post Vulnerability issue within my application. Concern: To prevent overwhelming connections from a single user, I have implemented express-rate-limit to ensure the application remains available. const rateLimit = require ...

There are no JavaScript files in the app bundle during the AU run

After recently updating my Aurelia application to the latest version, I am encountering a runtime error without any build-time errors being reported. The error message reads: Uncaught TypeError: Cannot read property '__useDefault' of undefined a ...

What is the purpose of running the command 'npm outdated --depth=0' in order to compare discrepancies?

After executing the command npm outdated --depth=0, I noticed the following: Package Current Wanted Latest Location cordova 5.4.1 5.4.1 6.0.0 cordova grunt-angular- ...

Having trouble with installing the angular-4-data-table-bootstrap-4 package in NG 4.4.6 environment

I am currently working on an NG 4 project and my package.json indicates that I am using angular 4.4.6. I am attempting to include the angular-4-data-table-bootstrap-4 package as outlined below, but I keep encountering the error mentioned here that I can&ap ...

Confusion in Discord.js API Integration (G4F)

Seeking assistance with creating a discord chatbot using discord.js and g4f library. My background is mostly in python, so I'm not very familiar with node.js. Although I managed to get the login functionality working, the bot is not sending messages a ...

Issue with Typescript and react-create-app integration using Express

I'm relatively new to Typescript and I decided to kickstart a project using create-react-app. However, I encountered an issue while trying to connect my project to a server using express. After creating a folder named src/server/server.ts, React auto ...