skip to Main Content

I clone this source from GitHub and deploy to azure cloud, but when I run cmd "azd up" it was shown the error as below.
Here are my code:

import ReactDOM from 'react-dom/client';
import { createHashRouter, RouterProvider } from 'react-router-dom';
import { initializeIcons } from '@fluentui/react';

import './index.css';

import Layout from './pages/layout/Layout';
import Chat   from './pages/chat/Chat';

initializeIcons();

const router = createHashRouter([
    {
        path: "/",
        element: <Layout />,
        children: [
            {
                index: true,
                element: <Chat />
            },
            {
                path: "qa",
                lazy: () => import('./pages/oneshot/OneShot')
            },
            {
                path: "*",
                lazy: () => import('./pages/NoPage')
            }
        ]
    }
]);

ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(
    <React.StrictMode>
        <RouterProvider router={router} />
    </React.StrictMode>
);
Could not resolve "./pages/layout/Layout" from "src/index.tsx"
file: D:C#OpenAIOpenAICustomKBappfrontendsrcindex.tsx
error during build:
RollupError: Could not resolve "./pages/layout/Layout" from "src/index.tsx"
    at error (file:///D:/C%23/OpenAI/OpenAICustomKB/app/frontend/node_modules/rollup/dist/es/shared/node-entry.js:2245:30)
    at ModuleLoader.handleInvalidResolvedId (file:///D:/C%23/OpenAI/OpenAICustomKB/app/frontend/node_modules/rollup/dist/es/shared/node-entry.js:24650:24)
    at file:///D:/C%23/OpenAI/OpenAICustomKB/app/frontend/node_modules/rollup/dist/es/shared/node-entry.js:24612:26
  (x) Failed: Packaging service backend

ERROR: failed packaging service 'backend': failed invoking event handlers for 'prepackage', 'prepackage' hook failed with exit code: '1', Path: 'C:UserslocnsoAppDataLocalTempazd-prepackage-825251035.ps1'. : exit code: 1

enter image description here

I google it but I newbie in node.js so I don’t know what does the error message mean?

2

Answers


  1. Chosen as BEST ANSWER

    This issue had fixed. The reason is in my folder path contains special character '#' so it cause this error.


  2. ERROR: failed packaging service ‘backend’: failed invoking event handlers for ‘prepackage’, ‘prepackage’ hook failed with exit code: ‘1’, Path: ‘C:UserslocnsoAppDataLocalTempazd-prepackage-825251035.ps1’. : exit code: 1

    • Mostly the error which you get is when the specified file or path does not exist or is not accessible then you will find this. check this link for more info.

    I had reproduced by deploying frontend application from GitHub to App service via Azure portal check the below steps.

    • Login-in to azure portal and click on create app service give the specific details then after to the second section there will be the deployment there you need to specify your GitHub repository details as below.

    enter image description here

    • You can check the workflow before deploying by clicking on preview.

    enter image description here

    • Then click on create the application which is in github repository will be directly deployed into the app service.

    • You can check the deployment status in the portal or directly in the GitHub actions.

    Deployment status:

    enter image description here

    Also please check the Failed prepackaging service for more information.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search