Closed willbaginski closed 4 years ago
From the looks of it, I think you might be trying to run your code from a directory that node doesn't recognize. You might want to run from the project
directory
I'm running the command in the project
directory. Sorry, that part wasn't clear in the original post. After running, the node_modules
directory is created in the project
directory. The three directories for the modules are created within node_modules
. I am not sure what else might be going wrong ... if this is more of a stackoverflow kind of question please feel free to close this issue, btw.
One more thing I just realized... this package does not have any TypeScript types, so if you are trying to use it with TypeScript you will need to use an explicit any
type to get around that warning.
But yeah this still sounds like an issue with how you are using the package or running the code rather than with the package itself. I would give stackoverflow a shot and see what turns up. If you still suspect it's a package issue, feel free to come back here and open another issue.
npm WARN saveError ENOENT: no such file or directory, open '...\project\package.json' npm notice created a lockfile as package-lock.json. You should commit this file. npm WARN enoent ENOENT: no such file or directory, open '...\project\package.json' npm WARN project No description npm WARN project No README data npm WARN project No license field.
It seems to me as though all the right files exist in node_modules/newsapi (node-modules/newsapi/package.json is created) but ultimately I can tell that there is a problem because the following line
const NewsAPI = require('newsapi');
throws me this warning about the declaration file: "Could not find a declaration file for module 'newsapi'. '.../project/node_modules/newsapi/dist/index.js' implicitly has an 'any' type. Trynpm install @types/newsapi
if it exists or add a new declaration (.d.ts) file containingdeclare module 'newsapi';
ts(7016)"