简体   繁体   English

模块“util”已被外部化以实现浏览器兼容性。 无法在客户端代码中访问“util.promisify”

[英]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.

相关问题 React-markdown 无法正常工作 - 模块“进程”已被外部化以实现浏览器兼容性。 无法在客户端代码中访问“process.cwd” - React-markdown not working properly - Module "process" has been externalized for browser compatibility. Cannot access "process.cwd" in client code NodeJs util.promisify 不是函数 - NodeJs util.promisify is not a function TypeError:util.promisify不是函数吗? - TypeError: util.promisify is not a function? 节点:util.promisify() 没有回调作为最终参数 - Node: util.promisify() without callback as final parameter 有没有办法在打字稿上使用 util.promisify 继承方法签名? - Is there any way to inherit method signature with util.promisify on typescript? &#39;util.promisify(setTimeout)&#39; 和 &#39;ms =&gt; new Promise(resolve =&gt; setTimeout(resolve, ms))&#39; 之间的区别 - difference between 'util.promisify(setTimeout)' and 'ms => new Promise(resolve => setTimeout(resolve, ms))' Continue.map 循环后 util.promisify 请求迭代失败(异步等待) - Continue .map loop after util.promisify request fails in iteration (async await) Node.js util.promisify-将stdout输出为obj或数组而不是换行 - Node.js util.promisify - Output stdout as obj or array instead of new lines 如何通过writeFile fs函数使用节点js util.promisify并等待 - How to use node js util.promisify with the writeFile fs function and await Postgres:何时在查询中使用.end() vs.release()(这在 util.promisify 中是否发生了变化)? 缺少这些功能是否会增加 memory 的使用量? - Postgres: When to use .end() vs .release() in queries (and does this change in util.promisify)? Does lack of these functions increase memory usage?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM