-
-
Notifications
You must be signed in to change notification settings - Fork 281
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Running website-scraper
Without a package.json
in the Working Directory Triggers Error
#512
Comments
Hi @manuth 👋 Thank you for reporting the problem |
Hey @s0ph1e Sorry for the inconvenience, I'll describe the steps for the reproduction real quick.
Assets
{
"type": "module",
"dependencies": {
"website-scraper": "^5.3.0"
},
"devDependencies": {
"@types/node": "^18.7.23",
"@types/website-scraper": "^1.2.6"
}
}
import { join } from "path";
import { fileURLToPath } from "url";
import websiteScraper from "website-scraper";
(
async () =>
{
await websiteScraper(
{
directory: join(fileURLToPath(new URL(".", import.meta.url)), "output"),
urls: [
"https://nodejs.org"
]
});
})(); |
Thanks @manuth 👍 I'll try to reproduce and fix it during next 1-2 weeks If anyone wants to contribute - PRs are welcome |
The bug was fixed and released in v5.3.1 |
Awesome! 😄 Thanks for the rapid fix |
Configuration
version:
5.3.0
options: options don't have an influence on this issue
Description
When running
website-scraper
with the current working directory set to a directory which does not contain apackage.json
file triggers an error.Expected behavior: The working directory should not have any side-effect of this sort
Actual behavior: An error is thrown:
Additional Information
This error is caused by this piece of code:
node-website-scraper/lib/config/defaults.js
Lines 2 to 3 in de75674
As seen in this piece of code, this statement relies on a
package.json
file to exist in the current working directory.A workaround is sadly not possible at time of writing.
The text was updated successfully, but these errors were encountered: