Closed briantical closed 3 years ago
Hi @briantical ,
Good afternoon, I Create a basic project with react using the command
npx create-react-app my-app
Unfortunately it shows me the same error, and I don't know what it really is and what the solution to the problem would be.
I'll leave the issue open, to see if anyone can help.
In the meantime, what I can recommend is that you use the API endpoints from the following URL
App.js
import React , {useState , useEffect} from 'react';
import {getJohnsHopkinsDataDailyReport} from 'covid19-api'
import './App.css';
function App() {
const [get , set] = useState([]);
useEffect(() =>{
const f = async() =>{
const data = await getJohnsHopkinsDataDailyReport();
set(data)
}
f();
} , [])
return (
<div className="App">
<header className="App-header">
<pre>
{JSON.stringify(get, null, 2)}
</pre>
</header>
</div>
);
}
export default App;
output
./node_modules/keyv/src/index.js
Compiled with warnings.
./node_modules/cloudscraper/lib/brotli.js
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted
./node_modules/keyv/src/index.js
Hello @briantical ,
_After seeing the library updated to the new version 1.1.9 the problem persists but now with the following error._
Apparently the issue is related to the webpack + reactjs configuration
TypeError: The "original" argument must be of type Function
promisify
C:/Users/c/Desktop/my-app/node_modules/node-libs-browser/node_modules/util/util.js:601
598 | var kCustomPromisifiedSymbol = typeof Symbol !== 'undefined' ? Symbol('util.promisify.custom') : undefined;
599 |
600 | exports.promisify = function promisify(original) {
> 601 | if (typeof original !== 'function')
602 | throw new TypeError('The "original" argument must be of type Function');
603 |
604 | if (kCustomPromisifiedSymbol && original[kCustomPromisifiedSymbol]) {
Hey @ChrisMichaelPerezSantiago, I'm sorry to the sent message here. Your API https://covid19api.io/api/v1 does not work, what happened?
Congratulation for your job, you save many lives with your data.
Hello @flasfl , Sorry for the delay, I hadn't seen your message.
The API using the url https://covid19api.io/api/v1
stopped working since it was being sponsored by the Vercel
company and for them it was being costly to be able to maintain the API on the server due to the amount of traffic. This increase is reflected in a costly payment.
Even so, the npm package is still available for javascript applications.
After installation of the module, my create-react-app crashes with this error in the console:
Compiled with warnings. ./node_modules/cloudscraper/lib/brotli.js Critical dependency: require function is used in a way in which dependencies cannot be statically extracted ./node_modules/keyv/src/index.js Critical dependency: the request of a dependency is an expression
.I am on the latest version (1.1.7), I already uninstalled the node modules and reinstalled them.
I also have this warning when I am importing the module into the project.
Could not find a declaration file for module 'covid19-api'. 'projectdir/node_modules/covid19-api/src/api/index.js' implicitly has an 'any' type. Try
npm install @types/covid19-apiif it exists or add a new declaration (.d.ts) file containing
declare module 'covid19-api';ts(7016)