[英]Module "util" has been externalized for browser compatibility. Cannot access "util.promisify" in client code
I am trying to scrap linkeidn profile using this library: https://www.npmjs.com/package/@nhn/linkedin-profile-scraper .我正在尝试使用此库删除 linkeidn 配置文件: https://www.npmjs.com/package/@nhn/linkedin-profile-scraper 。 this is my code:这是我的代码:
<script>
import { LinkedInProfileScraper } from '@matidiaz/linkedin-profile-scraper';
import { onMount } from 'svelte';
import { session } from '$app/stores';
onMount(async () => {
const token = session?.provider_token;
console.log(token);
const scraper = new LinkedInProfileScraper({
sessionCookieValue: token,
keepAlive: false
});
// Prepare the scraper
// Loading it in memory
await scraper.setup();
const result = await scraper.run('https://www.linkedin.com/in/jvandenaardweg/');
console.log(result);
});
</script>
I am using sveltekit to get the information, can someone point out how to solve this prb,I am not finding much information online.我正在使用 sveltekit 来获取信息,有人可以指出如何解决这个 prb,我在网上找不到太多信息。
npm i util,
however this lib continues giving errors so I removed it.但是这个库继续给出错误,所以我删除了它。
Hi what worked for me was to fix the vite.config.ts into something like this:嗨,对我有用的是将 vite.config.ts 修复为如下内容:
resolve: {解决: {
alias: {
process: "process/browser",
stream: "stream-browserify",
zlib: "browserify-zlib",
util: "util/",
'@': path.resolve(__dirname, './src'),
}
where we actually resolve the alias of util and add to it 'util/'我们实际上解析了 util 的别名并添加到它 'util/'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.