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

458
Visualizações
npm run build is giving me errors I'm not sure how to fix

This is my first app and first time trying to deploy and I'm facing an error I really don't know how to fix. This is what I'm getting when I run "npm run build"

PS C:\Users\julyj\Desktop\CODING\00 - Proton Media\BloCurate> npm run build

> proton-market@1.1.2 build
> next build

(node:11768) [DEP0148] DeprecationWarning: Use of deprecated folder mapping "./" in the "exports" field module resolution of the package at C:\Users\julyj\Desktop\CODING\00 - Proton Media\BloCurate\node_modules\postcss\package.json.
Update this package.json to use a subpath pattern like "./*".
(Use `node --trace-deprecation ...` to show where the warning was created)
Loaded env from C:\Users\julyj\Desktop\CODING\00 - Proton Media\BloCurate\.env.local
Failed to compile.

./components/AllAssets/index.tsx:32:8
Type error: Object is possibly 'undefined'.

  30 |   return (
  31 |     <ul>
> 32 |       {assets.map((result) => {
     |        ^
  33 |         const {
  34 |           collection: { name },
  35 |           data: { image },
info  - Creating an optimized production build .
PS C:\Users\julyj\Desktop\CODING\00 - Proton Media\BloCurate>

I tried looking up (node:11768) [DEP0148] and there was a suggestion about changing a format under node modules from "./" to "./*" but that didn't fix the error. I'm not sure if the error is being caused by that or if it's the type error that's shown below.

Although it says info - Creating an optimized production build at the bottom, it doesn't create the build folder. Not sure if I need to post more information here but I'll gladly do so if requested in order to solve this issue.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

The real error seems to be the TypeError in your TypeScript code. This can be fixed in two ways.


1. You can add the following code.

assets!.map( // ...

This tells TypeScript that the object will never have the value of undefined. Therefore, it will infer that the type is array, instead of array | undefined.


2. You can add the following code.

assets?.map( // ...

This code works both in JavaScript and TypeScript. The method used in this option is called optional chaining. It basically tells JavaScript/TypeScript that if assets is undefined, then it will not use the map() method, instead of throwing an error.


Extra: The DeprecationWarning can be safely ignored; it won't cause any issues with your deployment.

about 4 years ago · Juan Pablo Isaza 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