Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

283
Visualizações
500 process is not defined ReferenceError: process is not defined

I am getting this problem every time I import a lib or when I use puppeteer and I don't know how to fix it. I am trying to get some data from LinkedIn using https://www.npmjs.com/package/linkedin-client the code is easy:

import LinkedinClient from 'linkedin-client';
    async function getIt() {
        const session = supabase.auth.session();

        const tok = session?.provider_token;
        const token = JSON.stringify(tok);
        console.log(token);
        
        const client = new LinkedinClient(token);
        const data = await client.fetch('https://www.linkedin.com/in/some-profile/');
        console.log(data);
    }

at first it gives me this error:Module "util" has been externalized for browser compatibility. Cannot access "util.promisify" in client code

after I install npm i util then it displays the following error:

500 process is not defined ReferenceError: process is not defined

Can you please let me know how to fix it?(I'm using sveltekit)

about 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

The library requires to be run on the server. It has be in a server endpoint, it cannot be in a component or a load function.

If this is already the case, this might be an issue with Vite trying to remove server dependencies. There is e.g. a plugin @esbuild-plugins/node-globals-polyfill which polyfills the process variable. It may also be necessary to list packages in resolve.alias in the Vite config, to point to the Node modules.

about 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda