renative icon indicating copy to clipboard operation
renative copied to clipboard

[web] build/export error on RNV new project

Open GabrieleKaceviciute opened this issue 1 year ago • 5 comments

Describe the bug Can't build/export web without errors

To Reproduce

  1. Install [email protected] with npm globally
  2. create new project with rnv new and choose rnv/template-starter with same version
  3. do npx rnv export -p web
✖ FAILED: npx next build
┌──────────────────────────────────────────────────────────────────────────────┐
│  🚀  SUMMARY | 10/6/2023, 3:33:01 PM                                         │
│  $ rnv build -p web                                                          │
├──────────────────────────────────────────────────────────────────────────────┤
│  ReNative Version: 0.37.3                                                    │
│  Project Name ($package.name): first                                         │
│  Project Version ($package.version): 0.1.0                                   │
│  Workspace ($.workspaceID): rnv                                              │
│  Platform (-p): web                                                          │
│  Engine ($.platforms.web.engine): engine-rn-next                             │
│  Template: @rnv/[email protected]                              │
│  App Config (-c): app                                                        │
│  Build Scheme (-s): debug                                                    │
│  Supported Platforms: web                                                    │
│  Env Info: darwin | x64 | node v18.18.0                                      │
│  Executed Time: 0h:2m:13s:647ms                                              │
│                                                                              │
│ [ success ] [project configure] /next/dist/lib/find-pages-dir.js requires override by: /@flexn/plugins/pluginTemplates/next/overrides.json. FIXING...DONE
│ [ error ] [build] COMMAND:

npx next build

FAILED with ERROR:

> Build error occurred
TypeError: Cannot read properties of undefined (reading 'and')
    at Object.webpack (/Users/gabriele/Desktop/tests/first/node_modules/next-transpile-modules/src/next-transpile-modules.js:201:60)
    at Object.webpack (/Users/gabriele/Desktop/tests/first/node_modules/@rnv/engine-rn-next/node_modules/next-images/index.js:63:27)
    at Object.webpack (/Users/gabriele/Desktop/tests/first/node_modules/@rnv/engine-rn-next/node_modules/next-fonts/index.js:42:27)
    at Object.webpack (/Users/gabriele/Desktop/tests/first/node_modules/@expo/next-adapter/src/withExpo.ts:30:27)
    at webpack (/Users/gabriele/Desktop/tests/first/node_modules/next/src/build/webpack-config.ts:2991:28)
    at async Promise.all (index 0)
    at Span.traceAsyncFn (/Users/gabriele/Desktop/tests/first/node_modules/next/src/trace/trace.ts:110:14)
    at webpackBuildImpl (/Users/gabriele/Desktop/tests/first/node_modules/next/src/build/webpack-build/impl.ts:115:19)
    at webpackBuild (/Users/gabriele/Desktop/tests/first/node_modules/next/src/build/webpack-build/index.ts:114:12)
    at /Users/gabriele/Desktop/tests/first/node_modules/next/src/build/index.ts:1027:53

Command failed with exit code 1: npx next build
 ⚠ You are using a non-standard "NODE_ENV" value in your environment. This creates inconsistencies in the project and is strongly advised against. Read more: https://nextjs.org/docs/messages/non-standard-node-env
 ⚠ Invalid next.config.js options detected:
 ⚠     The root value has an unexpected property, projectRoot, which is not in the list of allowed properties (amp, analyticsId, assetPrefix, basePath, cleanDistDir, compiler, compress, configOrigin, crossOrigin, devIndicators, distDir, env, eslint, excludeDefaultMomentLocales, experimental, exportPathMap, generateBuildId, generateEtags, headers, httpAgentOptions, i18n, images, modularizeImports, onDemandEntries, optimizeFonts, output, outputFileTracing, pageExtensions, poweredByHeader, productionBrowserSourceMaps, publicRuntimeConfig, reactProductionProfiling, reactStrictMode, redirects, rewrites, sassOptions, serverRuntimeConfig, skipMiddlewareUrlNormalize, skipTrailingSlashRedirect, staticPageGenerationTimeout, swcMinify, target, trailingSlash, transpilePackages, typescript, useFileSystemPublicRoutes, webpack).
 ⚠ See more info here: https://nextjs.org/docs/messages/invalid-next-config

> Build error occurred
TypeError: Cannot read properties of undefined (reading 'and')
    at Object.webpack (/Users/gabriele/Desktop/tests/first/node_modules/next-transpile-modules/src/next-transpile-modules.js:201:60)
    at Object.webpack (/Users/gabriele/Desktop/tests/first/node_modules/@rnv/engine-rn-next/node_modules/next-images/index.js:63:27)
    at Object.webpack (/Users/gabriele/Desktop/tests/first/node_modules/@rnv/engine-rn-next/node_modules/next-fonts/index.js:42:27)
    at Object.webpack (/Users/gabriele/Desktop/tests/first/node_modules/@expo/next-adapter/src/withExpo.ts:30:27)
    at webpack (/Users/gabriele/Desktop/tests/first/node_modules/next/src/build/webpack-config.ts:2991:28)
    at async Promise.all (index 0)
    at Span.traceAsyncFn (/Users/gabriele/Desktop/tests/first/node_modules/next/src/trace/trace.ts:110:14)
    at webpackBuildImpl (/Users/gabriele/Desktop/tests/first/node_modules/next/src/build/webpack-build/impl.ts:115:19)
    at webpackBuild (/Users/gabriele/Desktop/tests/first/node_modules/next/src/build/webpack-build/index.ts:114:12)
    at /Users/gabriele/Desktop/tests/first/node_modules/next/src/build/index.ts:1027:53
Found custom dir:/Users/gabriele/Desktop/tests/first/src/pages
Found custom dir:/Users/gabriele/Desktop/tests/first/src/pages
   Creating an optimized production build...
   Disabled SWC as replacement for Babel because of custom Babel configuration "babel.config.js" https://nextjs.org/docs/messages/swc-disabled

 ⚠ You are using a non-standard "NODE_ENV" value in your environment. This creates inconsistencies in the project and is strongly advised against. Read more: https://nextjs.org/docs/messages/non-standard-node-env
 ⚠ Invalid next.config.js options detected:
 ⚠     The root value has an unexpected property, projectRoot, which is not in the list of allowed properties (amp, analyticsId, assetPrefix, basePath, cleanDistDir, compiler, compress, configOrigin, crossOrigin, devIndicators, distDir, env, eslint, excludeDefaultMomentLocales, experimental, exportPathMap, generateBuildId, generateEtags, headers, httpAgentOptions, i18n, images, modularizeImports, onDemandEntries, optimizeFonts, output, outputFileTracing, pageExtensions, poweredByHeader, productionBrowserSourceMaps, publicRuntimeConfig, reactProductionProfiling, reactStrictMode, redirects, rewrites, sassOptions, serverRuntimeConfig, skipMiddlewareUrlNormalize, skipTrailingSlashRedirect, staticPageGenerationTimeout, swcMinify, target, trailingSlash, transpilePackages, typescript, useFileSystemPublicRoutes, webpack).
 ⚠ See more info here: https://nextjs.org/docs/messages/invalid-next-config

> Build error occurred
TypeError: Cannot read properties of undefined (reading 'and')
    at Object.webpack (/Users/gabriele/Desktop/tests/first/node_modules/next-transpile-modules/src/next-transpile-modules.js:201:60)
    at Object.webpack (/Users/gabriele/Desktop/tests/first/node_modules/@rnv/engine-rn-next/node_modules/next-images/index.js:63:27)
    at Object.webpack (/Users/gabriele/Desktop/tests/first/node_modules/@rnv/engine-rn-next/node_modules/next-fonts/index.js:42:27)
    at Object.webpack (/Users/gabriele/Desktop/tests/first/node_modules/@expo/next-adapter/src/withExpo.ts:30:27)
    at webpack (/Users/gabriele/Desktop/tests/first/node_modules/next/src/build/webpack-config.ts:2991:28)
    at async Promise.all (index 0)
    at Span.traceAsyncFn (/Users/gabriele/Desktop/tests/first/node_modules/next/src/trace/trace.ts:110:14)
    at webpackBuildImpl (/Users/gabriele/Desktop/tests/first/node_modules/next/src/build/webpack-build/impl.ts:115:19)
    at webpackBuild (/Users/gabriele/Desktop/tests/first/node_modules/next/src/build/webpack-build/index.ts:114:12)
    at /Users/gabriele/Desktop/tests/first/node_modules/next/src/build/index.ts:1027:53

Error: Command failed with exit code 1: npx next build
 ⚠ You are using a non-standard "NODE_ENV" value in your environment. This creates inconsistencies in the project and is strongly advised against. Read more: https://nextjs.org/docs/messages/non-standard-node-env
 ⚠ Invalid next.config.js options detected:
 ⚠     The root value has an unexpected property, projectRoot, which is not in the list of allowed properties (amp, analyticsId, assetPrefix, basePath, cleanDistDir, compiler, compress, configOrigin, crossOrigin, devIndicators, distDir, env, eslint, excludeDefaultMomentLocales, experimental, exportPathMap, generateBuildId, generateEtags, headers, httpAgentOptions, i18n, images, modularizeImports, onDemandEntries, optimizeFonts, output, outputFileTracing, pageExtensions, poweredByHeader, productionBrowserSourceMaps, publicRuntimeConfig, reactProductionProfiling, reactStrictMode, redirects, rewrites, sassOptions, serverRuntimeConfig, skipMiddlewareUrlNormalize, skipTrailingSlashRedirect, staticPageGenerationTimeout, swcMinify, target, trailingSlash, transpilePackages, typescript, useFileSystemPublicRoutes, webpack).
 ⚠ See more info here: https://nextjs.org/docs/messages/invalid-next-config

> Build error occurred
TypeError: Cannot read properties of undefined (reading 'and')
    at Object.webpack (/Users/gabriele/Desktop/tests/first/node_modules/next-transpile-modules/src/next-transpile-modules.js:201:60)
    at Object.webpack (/Users/gabriele/Desktop/tests/first/node_modules/@rnv/engine-rn-next/node_modules/next-images/index.js:63:27)
    at Object.webpack (/Users/gabriele/Desktop/tests/first/node_modules/@rnv/engine-rn-next/node_modules/next-fonts/index.js:42:27)
    at Object.webpack (/Users/gabriele/Desktop/tests/first/node_modules/@expo/next-adapter/src/withExpo.ts:30:27)
    at webpack (/Users/gabriele/Desktop/tests/first/node_modules/next/src/build/webpack-config.ts:2991:28)
    at async Promise.all (index 0)
    at Span.traceAsyncFn (/Users/gabriele/Desktop/tests/first/node_modules/next/src/trace/trace.ts:110:14)
    at webpackBuildImpl (/Users/gabriele/Desktop/tests/first/node_modules/next/src/build/webpack-build/impl.ts:115:19)
    at webpackBuild (/Users/gabriele/Desktop/tests/first/node_modules/next/src/build/webpack-build/index.ts:114:12)
    at /Users/gabriele/Desktop/tests/first/node_modules/next/src/build/index.ts:1027:53
Found custom dir:/Users/gabriele/Desktop/tests/first/src/pages
Found custom dir:/Users/gabriele/Desktop/tests/first/src/pages
   Creating an optimized production build...
   Disabled SWC as replacement for Babel because of custom Babel configuration "babel.config.js" https://nextjs.org/docs/messages/swc-disabled
    at makeError (/Users/gabriele/Desktop/tests/first/node_modules/execa/lib/error.js:60:11)
    at handlePromise (/Users/gabriele/Desktop/tests/first/node_modules/execa/index.js:118:26)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)


│                                                                              │
│  Project location:                                                           │
│  ./platformBuilds/app_web                                                    │
└──────────────────────────────────────────────────────────────────────────────┘
➜  ~/Desktop/tests/first

Desktop (please complete the following information):

  • OS: macOS Ventura 13.5.2
  • Node Version 18.18.0
  • RNV Version 1.0.0-canary.1

GabrieleKaceviciute avatar Oct 06 '23 11:10 GabrieleKaceviciute

@GabrieleKaceviciute are you sure this was run with npx? Cause I see a mismatch in the summary

ReNative Version: 0.37.3                                                   
......                          
Template: @rnv/[email protected]         

mihaiblaga89 avatar Oct 25 '23 06:10 mihaiblaga89

@mihaiblaga89 I will double check, when rnv new will work

GabrieleKaceviciute avatar Oct 25 '23 07:10 GabrieleKaceviciute

@mihaiblaga89 on @rnv/[email protected] I'm getting this

✖ FAILED: npx next build
COMMAND:

npx next build

FAILED with ERROR:

Type error: 'View' cannot be used as a JSX component.
 Its instance type 'View' is not a valid JSX element.
 The types returned by 'render()' are incompatible between these types.
 Type 'React.ReactNode' is not assignable to type 'import("/Users/gabriele/Desktop/tests/ketvirtas/node_modules/@types/react-dom/node_modules/@types/react/ts5.0/index").ReactNode'.
 Type 'ReactElement<any, string | JSXElementConstructor<any>>' is not assignable to type 'ReactNode'.
 Property 'children' is missing in type 'ReactElement<any, string | JSXElementConstructor<any>>' but required in type 'ReactPortal'.

Command failed with exit code 1: npx next build
Failed to compile.

./src/app/index.tsx:25:10
Type error: 'View' cannot be used as a JSX component.
  Its instance type 'View' is not a valid JSX element.
    The types returned by 'render()' are incompatible between these types.
      Type 'React.ReactNode' is not assignable to type 'import("/Users/gabriele/Desktop/tests/ketvirtas/node_modules/@types/react-dom/node_modules/@types/react/ts5.0/index").ReactNode'.
        Type 'ReactElement<any, string | JSXElementConstructor<any>>' is not assignable to type 'ReactNode'.
          Property 'children' is missing in type 'ReactElement<any, string | JSXElementConstructor<any>>' but required in type 'ReactPortal'.

  23 |
  24 |     return (
> 25 |         <View style={theme.styles.container}>
     |          ^
  26 |             <Image
  27 |                 style={theme.styles.image}
  28 |                 source={ICON_LOGO}
   Creating an optimized production build...
   Disabled SWC as replacement for Babel because of custom Babel configuration "babel.config.js" https://nextjs.org/docs/messages/swc-disabled
   Using external babel configuration from /Users/gabriele/Desktop/tests/ketvirtas/babel.config.js
 ✓ Compiled successfully
   Linting and checking validity of types...

   We detected TypeScript in your project and reconfigured your tsconfig.json file for you. Strict-mode is set to false by default.
   The following suggested values were added to your tsconfig.json. These values can be changed to fit your project's needs:

   	- include was updated to add 'platformBuilds/app_web/.next/types/**/*.ts'


Failed to compile.

./src/app/index.tsx:25:10
Type error: 'View' cannot be used as a JSX component.
  Its instance type 'View' is not a valid JSX element.
    The types returned by 'render()' are incompatible between these types.
      Type 'React.ReactNode' is not assignable to type 'import("/Users/gabriele/Desktop/tests/ketvirtas/node_modules/@types/react-dom/node_modules/@types/react/ts5.0/index").ReactNode'.
        Type 'ReactElement<any, string | JSXElementConstructor<any>>' is not assignable to type 'ReactNode'.
          Property 'children' is missing in type 'ReactElement<any, string | JSXElementConstructor<any>>' but required in type 'ReactPortal'.

  23 |
  24 |     return (
> 25 |         <View style={theme.styles.container}>
     |          ^
  26 |             <Image
  27 |                 style={theme.styles.image}
  28 |                 source={ICON_LOGO}

Error: Command failed with exit code 1: npx next build
Failed to compile.

./src/app/index.tsx:25:10
Type error: 'View' cannot be used as a JSX component.
  Its instance type 'View' is not a valid JSX element.
    The types returned by 'render()' are incompatible between these types.
      Type 'React.ReactNode' is not assignable to type 'import("/Users/gabriele/Desktop/tests/ketvirtas/node_modules/@types/react-dom/node_modules/@types/react/ts5.0/index").ReactNode'.
        Type 'ReactElement<any, string | JSXElementConstructor<any>>' is not assignable to type 'ReactNode'.
          Property 'children' is missing in type 'ReactElement<any, string | JSXElementConstructor<any>>' but required in type 'ReactPortal'.

  23 |
  24 |     return (
> 25 |         <View style={theme.styles.container}>
     |          ^
  26 |             <Image
  27 |                 style={theme.styles.image}
  28 |                 source={ICON_LOGO}
   Creating an optimized production build...
   Disabled SWC as replacement for Babel because of custom Babel configuration "babel.config.js" https://nextjs.org/docs/messages/swc-disabled
   Using external babel configuration from /Users/gabriele/Desktop/tests/ketvirtas/babel.config.js
 ✓ Compiled successfully
   Linting and checking validity of types...

   We detected TypeScript in your project and reconfigured your tsconfig.json file for you. Strict-mode is set to false by default.
   The following suggested values were added to your tsconfig.json. These values can be changed to fit your project's needs:

   	- include was updated to add 'platformBuilds/app_web/.next/types/**/*.ts'

    at makeError (/Users/gabriele/Desktop/tests/ketvirtas/node_modules/execa/lib/error.js:60:11)
    at handlePromise (/Users/gabriele/Desktop/tests/ketvirtas/node_modules/execa/index.js:118:26)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)



 $ npx rnv export -p web - Done! 🚀
┌──────────────────────────────────────────────────────────────────────────────┐
│  🚀  SUMMARY | 10/25/2023, 6:44:17 PM                                        │
│  $ npx rnv export -p web                                                     │
├──────────────────────────────────────────────────────────────────────────────┤
│  ReNative Version: 1.0.0-canary.7                                            │
│  Project Name ($package.name): ketvirtas                                     │
│  Project Version ($package.version): 0.1.0                                   │
│  Workspace ($.workspaceID): rnv                                              │
│  Platform (-p): web                                                          │
│  Engine ($.platforms.web.engine): engine-rn-next                             │
│  Template: @rnv/[email protected]                              │
│  App Config (-c): app                                                        │
│  Build Scheme (-s): debug                                                    │
│  Supported Platforms: web                                                    │
│  Env Info: darwin | x64 | node v18.14.2                                      │
│  Executed Time: 0h:0m:17s:40ms                                               │
│                                                                              │
│  All good as 🦄                                                              │
│                                                                              │
│  Project location:                                                           │
│  ./platformBuilds/app_web                                                    │
└──────────────────────────────────────────────────────────────────────────────┘
➜  ~/Desktop/tests/ketvirtas

GabrieleKaceviciute avatar Oct 25 '23 15:10 GabrieleKaceviciute

no errors on 1.0.0-feat-bonanza.12

GabrieleKaceviciute avatar Nov 17 '23 12:11 GabrieleKaceviciute

works on 1.0.0-rc.6

pauliusguzas avatar Dec 20 '23 12:12 pauliusguzas