The netlify.toml you presented above does not match that in your code. Building from project root renders
./src/modules/register/RegisterConnector.tsx:1:36
Type error: Cannot find module '@abb/controller' or its corresponding type declarations.
> 1 | import { RegisterController } from "@abb/controller";
and building from the packages/web directory also fails.
Oh, i am sorry. I forgot the adding build command. Can you try again ?
You have to run the following commands :
yarn netlify init or ‘netlify init’ (in root of the project)
answers of the questions ? Your build command (hugo build/yarn run build/etc): yarn run build:web ? Directory to deploy (blank for current dir): packages\web\out ? Netlify functions folder: packages\web\out_functions
If you have Netlify CLI installed globally (as I do) then you only need run netlify <command> <options>. You can run locally using netlify dev (which I assume you are doing based on your netlify.toml), then to deploy you would run netlify deploy --build.
netlify dev and ntl dev and it’s started a server on http://localhost:8888/register
But when i run netlify deploy --build,same thing happening; Netlify trying deploy functions forever.
My deploy log:
$ netlify deploy --build
────────────────────────────────────────────────────────────────
Netlify Build
────────────────────────────────────────────────────────────────
> Version
@netlify/build 17.9.2
> Flags
{}
> Current directory
D:\Main\programming\projects\airbnb
> Config file
D:\Main\programming\projects\airbnb\netlify.toml
> Context
production
> Loading plugins
- @netlify/plugin-nextjs@3.8.0 from netlify.toml and package.json
────────────────────────────────────────────────────────────────
1. onPreBuild command from @netlify/plugin-nextjs
────────────────────────────────────────────────────────────────
Using Next.js 11.0.1
info - Loaded env from D:\Main\programming\projects\airbnb\packages\web\.env.production
info - Using webpack 5. Reason: Enabled by default https://nextjs.org/docs/messages/webpack5
Next.js cache restored.
(@netlify/plugin-nextjs onPreBuild completed in 7.1s)
────────────────────────────────────────────────────────────────
2. build.command from netlify.toml
────────────────────────────────────────────────────────────────
$ next build packages/web
info - Using webpack 5. Reason: Enabled by default https://nextjs.org/docs/messages/webpack5
info - Checking validity of types
(node:9024) [DEP_WEBPACK_CHUNK_HAS_ENTRY_MODULE] DeprecationWarning: Chunk.hasEntryModule: Use new ChunkGraph API
(Use `node --trace-deprecation ...` to show where the warning was created)
info - Creating an optimized production build
warn - Compiled with warnings
../../node_modules/next/dist/next-server/server/load-components.js
Critical dependency: the request of a dependency is an expression
../../node_modules/next/dist/next-server/server/load-components.js
Critical dependency: the request of a dependency is an expression
../../node_modules/next/dist/next-server/server/load-components.js
Critical dependency: the request of a dependency is an expression
../../node_modules/next/dist/next-server/server/require.js
Critical dependency: the request of a dependency is an expression
../../node_modules/next/dist/next-server/server/require.js
Critical dependency: the request of a dependency is an expression
../../node_modules/next/dist/next-server/server/require.js
Critical dependency: the request of a dependency is an expression
info - Collecting page data
[ ] info - Generating static pages (0/3)ServerRouter {
route: '/[testId]',
pathname: '/[testId]',
query: {},
asPath: '/[testId]',
basePath: '',
events: undefined,
isFallback: false,
locale: undefined,
isReady: false,
locales: undefined,
defaultLocale: undefined,
domainLocales: undefined,
isPreview: false,
isLocaleDomain: false
} router
info - Generating static pages (3/3)
info - Finalizing page optimization
Page Size First Load JS
┌ λ / 1.48 kB 128 kB
├ /_app 0 B 70.9 kB
├ ○ /[testId] 347 B 71.2 kB
├ ○ /404 1.36 kB 72.2 kB
├ λ /api/hello 0 B 70.9 kB
└ λ /register 34.6 kB 161 kB
+ First Load JS shared by all 70.9 kB
├ chunks/framework.e7644c.js 46.5 kB
├ chunks/main.848535.js 20.3 kB
├ chunks/pages/_app.483ead.js 2.49 kB
├ chunks/webpack.5b8c84.js 1.57 kB
└ css/47b8a6c68cf6d88dd75a.css 307 kB
λ (Lambda) server-side renders at runtime (uses getInitialProps or getServerSideProps)
○ (Static) automatically rendered as static HTML (uses no initial props)
● (SSG) automatically generated as static HTML + JSON (uses getStaticProps)
(ISR) incremental static regeneration (uses revalidate in getStaticProps)
(build.command completed in 1m 4.2s)
────────────────────────────────────────────────────────────────
3. onBuild command from @netlify/plugin-nextjs
────────────────────────────────────────────────────────────────
Detected Next.js site. Copying files...
** Running Next on Netlify package **
🚀 Next on Netlify 🚀
🌍️ Copying public folder to D:\Main\programming\projects\airbnb\packages\web\.next
💼 Copying static NextJS assets to D:\Main\programming\projects\airbnb\packages\web\.next
💫 Setting up API endpoints as Netlify Functions in D:\Main\programming\projects\airbnb\netlify\functions
💫 Setting up pages with getInitialProps as Netlify Functions in D:\Main\programming\projects\airbnb\netlify\functions
💫 Setting up pages with getServerSideProps as Netlify Functions in D:\Main\programming\projects\airbnb\netlify\functions
🔥 Copying pre-rendered pages with getStaticProps and JSON data to D:\Main\programming\projects\airbnb\packages\web\.next
💫 Setting up pages with getStaticProps and fallback: true as Netlify Functions in D:\Main\programming\projects\airbnb\netlify\functions
💫 Setting up pages with getStaticProps and revalidation interval as Netlify Functions in D:\Main\programming\projects\airbnb\netlify\functions
🔥 Copying pre-rendered pages without props to D:\Main\programming\projects\airbnb\packages\web\.next
Building 5 pages
🔀 Setting up redirects
🔀 Setting up headers
✅ Success! All done!
(@netlify/plugin-nextjs onBuild completed in 2.2s)
────────────────────────────────────────────────────────────────
4. Functions bundling
────────────────────────────────────────────────────────────────
Packaging Functions from netlify\functions directory:
- next_api_hello\next_api_hello.js
- next_image\next_image.js
- next_index\next_index.js
- next_register\next_register.js
(Functions bundling completed in 1m 19.4s)
────────────────────────────────────────────────────────────────
5. onPostBuild command from @netlify/plugin-nextjs
────────────────────────────────────────────────────────────────
Next.js cache saved.
(@netlify/plugin-nextjs onPostBuild completed in 820ms)
────────────────────────────────────────────────────────────────
Summary
────────────────────────────────────────────────────────────────
> @netlify/plugin-nextjs: Essential Next.js Build Plugin ran successfully
Generated serverless functions and stored the Next.js cache
────────────────────────────────────────────────────────────────
Netlify Build Complete
────────────────────────────────────────────────────────────────
(Netlify Build completed in 2m 44.4s)
Deploy path: D:\Main\programming\projects\airbnb\packages\web\.next
Functions path: D:\Main\programming\projects\airbnb\netlify\functions
Configuration path: D:\Main\programming\projects\airbnb\netlify.toml
Deploying to draft URL...
✔ Deploying functions from cache (use --skip-functions-cache to override)
✔ Finished hashing 75 files and 4 functions
✔ CDN requesting 20 files and 4 functions
(23/26) Uploading next image ...
Using the netlify.toml you last posted, when I run ntl deploy --build this is the result
────────────────────────────────────────────────────────────────
Netlify Build
────────────────────────────────────────────────────────────────
❯ Version
@netlify/build 17.9.2
❯ Flags
{}
❯ Current directory
/Users/coel/projects/airbnb-clone-staging
❯ Config file
/Users/coel/projects/airbnb-clone-staging/netlify.toml
❯ Context
production
❯ Loading plugins
- @netlify/plugin-nextjs@3.8.0 from netlify.toml and package.json
────────────────────────────────────────────────────────────────
1. onPreBuild command from @netlify/plugin-nextjs
────────────────────────────────────────────────────────────────
Using Next.js 11.0.1
info - Loaded env from /Users/coel/projects/airbnb-clone-staging/packages/web/.env.production
info - Using webpack 5. Reason: Enabled by default https://nextjs.org/docs/messages/webpack5
The "target" config property must be one of "serverless", "experimental-serverless-trace". Building with "serverless" target.
info - Using webpack 5. Reason: Enabled by default https://nextjs.org/docs/messages/webpack5
No Next.js cache to restore.
(@netlify/plugin-nextjs onPreBuild completed in 735ms)
────────────────────────────────────────────────────────────────
2. build.command from netlify.toml
────────────────────────────────────────────────────────────────
$ next build packages/web
info - Using webpack 5. Reason: Enabled by default https://nextjs.org/docs/messages/webpack5
Failed to compile.
./src/modules/register/RegisterConnector.tsx:1:36
Type error: Cannot find module '@abb/controller' or its corresponding type declarations.
> 1 | import { RegisterController } from "@abb/controller";
| ^
2 | import React from "react";
3 | import { useRegisterMutation } from "../../generated/graphql";
4 | import RegisterView from "./views/RegisterView";
info - Checking validity of types .
────────────────────────────────────────────────────────────────
"build.command" failed
────────────────────────────────────────────────────────────────
Error message
Command failed with exit code 1: next build packages/web
Error location
In build.command from netlify.toml:
next build packages/web
Resolved config
build:
command: next build packages/web
commandOrigin: config
publish: /Users/coel/projects/airbnb-clone-staging/packages/web/.next
publishOrigin: config
plugins:
- inputs: {}
origin: config
package: '@netlify/plugin-nextjs'