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
> [email protected] 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.
assets
will not be "undefined":assets!.map(
or use optional chaining:assets?.map(
DeprecationWarning
is, as the name suggests, just a warning. TheType error
is your problem. You should check fornull
/undefined
with?
or someif
statement prior to the return.