I'm using Typings in one of my TypeScript projects. I'm having a problem when running the command to install type definitions:
$ node_modules/.bin/typings install
typings ERR! message Unable to read typings for "angular". You should check the entry paths in "angular.d.ts" are up to date
typings ERR! caused by Unable to connect to "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/7ce80dafc0df189d61950e80e04548d8304d1538/angularjs/angular.d.ts"
typings ERR! caused by getaddrinfo ENOTFOUND raw.githubusercontent.com raw.githubusercontent.com:443
It would seem that it can't get angular.d.ts (ENOTFOUND). But I'm confused by this, because I can get that just fine with curl:
$ curl "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/7ce80dafc0df189d61950e80e04548d8304d1538/angularjs/angular.d.ts"
// Type definitions for Angular JS 1.4+
// Project: http://angularjs.org
. . .
Any ideas? Why is typings/node not able to find the type defs?
Node 6.3.0
Typings 1.3.2
npm 3.10.5
EDIT
I made a simple node script to try to reproduce the problem. Unfortunately, I was not able to reproduce it - this script works fine, even though typings install consistently produces the error.
var https = require('https');
var options = {
host: 'raw.githubusercontent.com',
path: '/DefinitelyTyped/DefinitelyTyped/7ce80dafc0df189d61950e80e04548d8304d1538/angularjs/angular.d.ts',
port: 443
};
var req = https.get(options, function(res) {
var str = '';
console.log(options.host + ':' + res.statusCode);
res.on('data', function(chunk) {
str += chunk;
});
res.on('end', function() {
console.log(str);
});
}).on('error', function(err) {
console.log('ERROR! ' + err);
});
EDIT 2
wget fails with an error about a certificate. Not sure if this is at all related:
$ wget "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/7ce80dafc0df189d61950e80e04548d8304d1538/angularjs/angular.d.ts"
--2016-08-16 20:00:13-- https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/7ce80dafc0df189d61950e80e04548d8304d1538/angularjs/angular.d.ts
Resolving raw.githubusercontent.com... 151.101.48.133
Connecting to raw.githubusercontent.com|151.101.48.133|:443... connected.
ERROR: certificate common name “www.github.com” doesn’t match requested host name “raw.githubusercontent.com”.
To connect to raw.githubusercontent.com insecurely, use ‘--no-check-certificate’.
Related
I am trying to connect to a DB2 server but I am getting bellow given error.
I'm following the given documentation: npm db2 Doc
I have done npm i ibm_db2
Code:
const ibmdb = require('ibm_db');
const connectQuery =
'DATABASE=' +
DATABASE +
';HOSTNAME=' +
HOSTNAME +
';UID=' +
UID +
';PWD=' +
PWD +
';PORT=' +
PORT +
';PROTOCOL=TCPIP';
ibmdb.open(connectQuery, function(err, conn) {
if (err) return console.log(err);
conn.query('select 1 from sysibm.sysdummy1', function(err, data) {
if (err) console.log('err');
else console.log('data');
conn.close(function() {
console.log('done');
});
});
});
Error:
Error: Could not locate the bindings file. Tried:
→ ...\node_modules\ibm_db\build\odbc_bindings.node
→ ...\node_modules\ibm_db\build\Debug\odbc_bindings.node
→ ...\node_modules\ibm_db\build\Release\odbc_bindings.node
→ ...\node_modules\ibm_db\out\Debug\odbc_bindings.node
→ ...\node_modules\ibm_db\Debug\odbc_bindings.node
Is there any other node package to establish connection ?
I have the same issue on windows 10. Because your ibm_db module is not installed successfully.
Download directly clidriver generated by IBM. After setting IBM_DB_HOME environment variable to point the directory, and reinstall ibm_db module to skip downloading clidriver.
I'm new to Node.js and react-native. I followed the sample on send_telemetry.js exactly but when I run my react-native app I get an error: "The development server returned response error code 500.
the error message is:
bundling failed: Error: Unable to resolve module fs from ProjectPath\node_modules\azure-iot-device\lib\module_client.js: Module fs does not exist in the Haste module map";
Im running:
Node.js v10.15.3
NPM 6.4.1
react-native#0.59.2
First error was the same with Unable to resolve module events,
I can install events,
but the fs module is: "This package name is not currently in use, but was formerly occupied by another package. To avoid malicious use, npm is hanging on to the package name, but loosely, and we'll probably give it to you if you want it."
var Protocol = require('azure-iot-device-http').Http;
var DeviceClient = require('azure-iot-device').Client;
var Message = require('azure-iot-device').Message;
var connectionString = 'my connection string';
var client = DeviceClient.fromConnectionString(connectionString, Protocol);
function ConnectionTest(err) {
if (err) {
console.log('Could not connect: ' + err);
} else {
console.log('Client connected');
}
client.close(function () {
process.exit(0);
});
};
export async function Test() {
client.open(ConnectionTest);
};
Basically I need to know how to get the azure IOT hub client working in my react-native app (not using Expo).
Im pretty much stumped so any help would greatly be appreciated.
A dependency module is missing ... which is fs ...
this file-system npm module is incompatible with react-native ... cause it has it own different environment.
I had "import { symlink } from 'fs';" randomly pop up in one of my scripts. Once I deleted this line same issue you had went away. I would search your whole project for that line.
My protractor test cases randomly fail with this error message:
Failed: ECONNREFUSED connect ECONNREFUSED 127.0.0.1
I have gone through the resources and tried all the suggested solutions:
Upgraded protractor
Ran webdriver-manager update
Upgraded chromedriver version but the issue seems to exist.
This particularly happens when I try to run all the e2e tests together.
Below is the specific versions that Im using for my project:
node - v9.2.0
protractor - Version 5.4.1
ChromeDriver 2.42.591088
Please help.
Thanks,
Neeraja
Are you using async/await in your tests?
Can you try applying patch as specified below from the same folder which contains the 'node_modules' folder by executing 'node patch.js'?
patch.js file
var fs = require('fs');
var httpIndexFile = 'node_modules/selenium-webdriver/http/index.js';
fs.readFile(httpIndexFile, 'utf8', function (err, data) {
if (err)
throw err;
var result = data.replace(/\(e.code === 'ECONNRESET'\)/g, "(e.code === 'ECONNRESET' || e.code === 'ECONNREFUSED')");
console.log(`Patching ${httpIndexFile}`)
fs.writeFileSync(httpIndexFile, result, 'utf8');});
var chromeFile = 'node_modules/selenium-webdriver/chrome.js';
fs.readFile(chromeFile, 'utf8', function (err, data) {
if (err)
throw err;
var result = data.replace(/new http.HttpClient\(url\)/g, "new http.HttpClient(url, new (require('http').Agent)({ keepAlive: true }))");
console.log(`Patching ${chromeFile}`)
fs.writeFileSync(chromeFile, result, 'utf8');});
Please see original post here -
https://github.com/angular/protractor/issues/4706#issuecomment-393004887
I am trying phantomjs in MEAN stack for report generation but after installing phantom binaries in my ubuntu os server and using phantom node_module + rasterize.js throws below error.
Error: Cannot find module 'events'
phantomjs://bootstrap.js:254 in require
/home/kb/code/backend/backend/api_server/node_modules/phantom/node_modules/dnode/node_modules/dnode-protocol/index.js:1
/home/kb/code/backend/backend/api_server/node_modules/phantom/node_modules/dnode/node_modules/dnode-protocol/index.js:126
Error: Cannot find module 'stream'
phantomjs://bootstrap.js:289
phantomjs://bootstrap.js:254 in require
/home/kb/code/backend/backend/api_server/node_modules/phantom/node_modules/dnode/lib/dnode.js:2
/home/kb/code/backend/backend/api_server/node_modules/phantom/node_modules/dnode/lib/dnode.js:154
Error: Cannot find module 'net'
phantomjs://bootstrap.js:289
phantomjs://bootstrap.js:254 in require
/home/kb/code/backend/backend/api_server/node_modules/phantom/node_modules/dnode/index.js:3
/home/kb/code/backend/backend/api_server/node_modules/phantom/node_modules/dnode/index.js:138
Error: Cannot find module 'http'
phantomjs://bootstrap.js:289
phantomjs://bootstrap.js:254 in require
/home/kb/code/backend/backend/api_server/node_modules/phantom/phantom.js:8
/home/kb/code/backend/backend/api_server/node_modules/phantom/phantom.js:193
/home/kb/code/backend/backend/api_server/node_modules/phantom/phantom.js:194
TypeError: 'undefined' is not a function (evaluating 'phantom.createWebPage()')
:/modules/webpage.js:905
report.js:7
This is my test code.
var phantom = require('phantom');
phantom.create(function (ph) {
ph.createPage(function (page) {
page.open("http://www.google.com", function (status) {
console.log("opened google? ", status);
page.evaluate(function () { return document.title; }, function (result) {
console.log('Page title is ' + result);
ph.exit();
});
});
});
});
Try run command:
npm install -g events stream net http
However, I think that you did wrong way to setup a Node Project. For example, If you want to create a project requires PhantomJS. You should do the steps below:
# create project directory
mkdir myproject
cd myproject
# install phantomjs for your project
npm install --save phantomjs
# create your project file
I have installed Node.Js and Casper.js to perform webscraping and save the info into a DB. But I have a problem because when I try to execute the source, I get the following error in the terminal:
Error: Cannot find module './build/Release/mysql_bindings'
I have previously installed mysql-libmysqlclient with the mysql_bindings inside. I tested creating the route of the error, but it didn't work.
The code is:
var mysql = require('db-mysql');
new mysql.Database({
hostname: 'localhost',
user: 'rool',
password: 'xxxx',
database: 'xxxBD' }).connect(function(error) {
if (error) {
return console.log('CONNECTION error: ' + error);
}
this.query().
select('*').
from('tablaPruebas').
execute(function(error, rows, cols) {
if (error) {
console.log('ERROR: ' + error);
return;
}
console.log(rows.length + ' ROWS found');
});
});
Thanks in advance!
The problem is that your using the following in your code:
var mysql = require('db-mysql');
However your question shows that you have installed mysql-libmysqlclient. This means you should be using the following instead:
var mysql = require('mysql-libmysqlclient');
I presume you installed from https://github.com/Sannis/node-mysql-libmysqlclient
The code you're using looks more like db-mysql which can be found here
If you install via npm install db-mysql then you should be good. Have a look at the link I included for db-mysql as there appears to be a few dependencies (e.g. setting up MYSQL_CONFIG environment variable).