quivr icon indicating copy to clipboard operation
quivr copied to clipboard

[Bug]: ERROR [frontend builder 4/4] RUN yarn build

Open viettt91 opened this issue 1 year ago • 2 comments

What happened?

Hi, When I run the command "docker compose up", an error occurs as follows, how can I fix it?

Relevant log output

[+] Building 77.0s (16/21)                                                                                                                                                                                                    docker:default
 => [frontend internal] load build definition from Dockerfile                                                                                                                                                                           0.0s
 => => transferring dockerfile: 2.76kB                                                                                                                                                                                                  0.0s
 => [frontend internal] load .dockerignore                                                                                                                                                                                              0.0s
 => => transferring context: 365B                                                                                                                                                                                                       0.0s
 => [frontend internal] load metadata for docker.io/library/node:18.19.0-alpine                                                                                                                                                         3.0s
 => [frontend internal] load build context                                                                                                                                                                                              0.1s
 => => transferring context: 77.66kB                                                                                                                                                                                                    0.1s
 => [frontend base 1/1] FROM docker.io/library/node:18.19.0-alpine@sha256:b1a0356f7d6b86c958a06949d3db3f7fb27f95f627aa6157cb98bc65c801efa2                                                                                              0.0s
 => CACHED [frontend builder 1/4] WORKDIR /app                                                                                                                                                                                          0.0s
 => CACHED [frontend runner 2/8] RUN addgroup --system --gid 1001 nodejs                                                                                                                                                                0.0s
 => CACHED [frontend runner 3/8] RUN adduser --system --uid 1001 nextjs                                                                                                                                                                 0.0s
 => CACHED [frontend deps 1/5] RUN apk add --no-cache libc6-compat python3 make g++                                                                                                                                                     0.0s
 => CACHED [frontend deps 2/5] RUN yarn global add node-gyp                                                                                                                                                                             0.0s
 => CACHED [frontend deps 3/5] WORKDIR /app                                                                                                                                                                                             0.0s
 => CACHED [frontend deps 4/5] COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./                                                                                                                                       0.0s
 => CACHED [frontend deps 5/5] RUN     if [ -f yarn.lock ]; then yarn --frozen-lockfile;     elif [ -f package-lock.json ]; then npm ci;     elif [ -f pnpm-lock.yaml ]; then yarn global add pnpm && pnpm i --frozen-lockfile;     el  0.0s
 => CACHED [frontend builder 2/4] COPY --from=deps /app/node_modules ./node_modules                                                                                                                                                     0.0s
 => CACHED [frontend builder 3/4] COPY . .                                                                                                                                                                                              0.0s
 => ERROR [frontend builder 4/4] RUN yarn build                                                                                                                                                                                        73.8s
------
 > [frontend builder 4/4] RUN yarn build:
0.703 yarn run v1.22.19
0.730 $ next build
1.427 Attention: Next.js now collects completely anonymous telemetry regarding usage.
1.427 This information is used to shape Next.js' roadmap and prioritize features.
1.427 You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
1.427 https://nextjs.org/telemetry
1.427
1.530    ▲ Next.js 14.1.0
1.530
1.611    Creating an optimized production build ...
49.41  ✓ Compiled successfully
49.41    Linting and checking validity of types ...
73.58
73.58 Failed to compile.
73.58
73.58 ./app/brains-management/[brainId]/components/BrainManagementTabs/components/KnowledgeOrSecretsTab/hooks/useKnowledge.ts
73.58 13:36  Warning: Forbidden non-null assertion.  @typescript-eslint/no-non-null-assertion
73.58 14:47  Warning: Forbidden non-null assertion.  @typescript-eslint/no-non-null-assertion
73.58
73.58 ./app/brains-management/[brainId]/components/BrainManagementTabs/components/SettingsTab/hooks/usePrompt.ts
73.58 158:11  Warning: Caution: `axios` also has a named export `isAxiosError`. Check if you meant to write `import {isAxiosError} from 'axios'` instead.  import/no-named-as-default-member
73.58
73.58 ./app/brains-management/[brainId]/components/BrainManagementTabs/components/SettingsTab/hooks/useSettingsTab.ts
73.58 72:11  Warning: Caution: `axios` also has a named export `isAxiosError`. Check if you meant to write `import {isAxiosError} from 'axios'` instead.  import/no-named-as-default-member
73.58 120:11  Warning: Caution: `axios` also has a named export `isAxiosError`. Check if you meant to write `import {isAxiosError} from 'axios'` instead.  import/no-named-as-default-member
73.58
73.58 ./app/brains-management/[brainId]/components/BrainManagementTabs/hooks/useBrainFetcher.ts
73.58 31:32  Warning: Forbidden non-null assertion.  @typescript-eslint/no-non-null-assertion
73.58 38:34  Warning: Forbidden non-null assertion.  @typescript-eslint/no-non-null-assertion
73.58
73.58 ./app/chat/[chatId]/components/ChatDialogueArea/components/ChatDialogue/components/QADisplay/components/MessageRow/MessageRow.tsx
73.58 47:11  Error: 'hasSources' is assigned a value but never used.  @typescript-eslint/no-unused-vars
73.58
73.58 ./app/chat/[chatId]/components/DataPanel/components/RelatedBrains/RelatedBrains.tsx
73.58 4:8  Warning: Using exported name 'Icon' as identifier for default export.  import/no-named-as-default
73.58
73.58 ./app/invitation/[brainId]/hooks/useInvitation.ts
73.58 46:13  Warning: Caution: `axios` also has a named export `isAxiosError`. Check if you meant to write `import {isAxiosError} from 'axios'` instead.  import/no-named-as-default-member
73.58 78:11  Warning: Caution: `axios` also has a named export `isAxiosError`. Check if you meant to write `import {isAxiosError} from 'axios'` instead.  import/no-named-as-default-member
73.58 110:11  Warning: Caution: `axios` also has a named export `isAxiosError`. Check if you meant to write `import {isAxiosError} from 'axios'` instead.  import/no-named-as-default-member
73.58
73.58 ./lib/components/AddBrainModal/components/AddBrainSteps/AddBrainSteps.tsx
73.58 4:8  Warning: Using exported name 'TextButton' as identifier for default export.  import/no-named-as-default
73.58
73.58 ./lib/context/MenuProvider/Menu-provider.tsx
73.58 25:68  Warning: Forbidden non-null assertion.  @typescript-eslint/no-non-null-assertion
73.58
73.58 ./lib/hooks/useShareBrain.ts
73.58 84:11  Warning: Caution: `axios` also has a named export `isAxiosError`. Check if you meant to write `import {isAxiosError} from 'axios'` instead.  import/no-named-as-default-member
73.58
73.58 info  - Need to disable some ESLint rules? Learn more here: https://nextjs.org/docs/basic-features/eslint#disabling-rules
73.71 error Command failed with exit code 1.
73.71 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
------
failed to solve: process "/bin/sh -c yarn build" did not complete successfully: exit code: 1

Twitter / LinkedIn details

No response

viettt91 avatar Jan 26 '24 08:01 viettt91

🤖

Hey there @viettt91! Good to see you back around these parts. Let's dive into this issue you're facing, shall we?

From the error log you provided, it seems like the build is failing due to some ESLint warnings and errors. ESLint is a tool for identifying and reporting on patterns found in ECMAScript/JavaScript code, with the goal of making code more consistent and avoiding bugs.

Here are the issues that are causing the build to fail:

  1. Forbidden non-null assertion: This warning is due to the use of non-null assertions in your TypeScript code. Non-null assertions are a way to tell the compiler "this expression cannot be null or undefined here, so don't issue a nullability warning." The use of non-null assertions is generally discouraged because it undermines the safety that comes from the strict null checking mode.

  2. 'hasSources' is assigned a value but never used: This error is due to a variable 'hasSources' being declared and assigned a value, but never used in the code. Unused variables can lead to confusion by readers of the code and they take up space.

  3. Using exported name 'Icon' as identifier for default export: This warning is due to using the exported name 'Icon' as the identifier for the default export. This can be confusing because it's not clear whether you're referring to the default export or the named export.

  4. Caution: axios also has a named export isAxiosError: This warning is due to using the default import from 'axios' as if it were a named import. This can be confusing because it's not clear whether you're referring to the default export or the named export.

To fix these issues, you should:

  1. Avoid using non-null assertions. Instead, use proper checks to ensure that the value is not null or undefined.

  2. Remove the 'hasSources' variable or use it in your code.

  3. Use a different name for your default export or for your named export.

  4. Use the named import from 'axios' instead of the default import.

You can also consider disabling some ESLint rules if they are not relevant to your project. However, this should be done with caution as these rules are usually there for a reason. You can learn more about disabling rules in the Next.js ESLint documentation.

I hope this helps! If you have any other questions, feel free to ask.

Best regards, Dosu

Sources


This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

If you want to continue the conversation, start your reply with @dosu-bot.

dosubot[bot] avatar Jan 26 '24 08:01 dosubot[bot]

I met this problem too on ubuntu server. Solution is : Edit "frontend/.eslintrc" file and disable "@typescript-eslint/no-unused-vars" ESLint rule, Then re-run "docker compose up" could save the problem.

Change 'error' to 'off' as following : c0c49e04043dbc2b1612d14d08817c0

Actualy there are prompts in output logs : be94d1ab37ca2cb3aa55a9696aac7a6

baoheping avatar Jan 27 '24 14:01 baoheping

Thanks for your contributions, we'll be closing this issue as it has gone stale. Feel free to reopen if you'd like to continue the discussion.

github-actions[bot] avatar Apr 26 '24 16:04 github-actions[bot]