Skip to content

Code Nextjs-v14 throws error when try to run #3760

Closed
@tomani77

Description

@tomani77

Getting Error while running NextJs code from Next-v14.

#1. after running yarn start, it throws following error -

Error: Cannot find module 'webpack/lib/javascript/BasicEvaluatedExpression'
[1] Require stack:
[1] - /Folder/module-federation-examples/nextjs-v14/node_modules/next/dist/compiled/webpack/webpack.js

Seems above error is due to missing webpack.

#2. executed yarn add webpack in both the folders i.e. home and shop.

#3 from root i.e. nextjs-v14 run yarn start
terminal shows following message -

[ Module Federation Manifest Plugin ]: Manifest will not generate, because publicPath can only be absolute path, but got 'auto'
[1] (node:32415) [DEP_WEBPACK_PRE_COMPILED_SCHEMA_INVALID] DeprecationWarning: webpack bug: Pre-compiled schema reports error while real schema is happy. This has performance drawbacks.

#4 Access application using http://localhost:3001.

Unhandled Runtime Error
Error: Hydration failed because the initial UI does not match what was rendered on the server.

Warning: Expected server HTML to contain a matching in

.
See more info here: https://nextjs.org/docs/messages/react-hydration-error

Unhandled Runtime Error
Error: There was an error while hydrating. Because the error happened outside of a Suspense boundary, the entire root will switch to client rendering.

runtime environment - Mac
Node version - v21.5.0
yarn version - 1.22.15

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions