gpt4 book ai didi

reactjs - 如何解决下一个js项目中的npm错误

转载 作者:行者123 更新时间:2023-12-03 06:41:55 27 4
gpt4 key购买 nike

我是下一个 js/react js 项目。在我的本地,它运行得很好,页面上的任何更新也会在网站上更新。我已经使用 azure 部署了这个项目,我的存储库位于 Github Action 中。我还有 Github Action 设置。我创建了一个新分支并在那里进行了一些更改,最后我将此分支合并到主分支,但我的更改并未生效。在 Github Action 中的“构建和部署”下,它显示以下错误


App Directory Location: '/' was found.
Looking for event info
Starting to build app with Oryx
Azure Static Web Apps utilizes Oryx to build both static applications and Azure Functions. You can find more details on Oryx here: https://github.com/microsoft/Oryx
---Oryx build logs---


Operation performed by Microsoft Oryx, https://github.com/Microsoft/Oryx
You can report issues at https://github.com/Microsoft/Oryx/issues

Oryx Version: 0.2.20221103.1, Commit: a2c65dde152b749fea395f4d1242ea9350942258, ReleaseTagName: 20221103.1

Build Operation ID: |c+FkE1pA5Rs=.7d546986_
Repository Commit : 065130ddcad0d0d8b0c5b136069ae0f375d3d64e

Detecting platforms...
Detected following platforms:
nodejs: 16.18.0
Version '16.18.0' of platform 'nodejs' is not installed. Generating script to install it...
Detected the following frameworks: Next.js


Source directory : /github/workspace
Destination directory: /bin/staticsites/ss-oryx/app


Downloading and extracting 'nodejs' version '16.18.0' to '/opt/nodejs/16.18.0'...
Detected image debian flavor: bullseye.
Downloaded in 1 sec(s).
Verifying checksum...
Extracting contents...
performing sha512 checksum for: nodejs...
Done in 2 sec(s).

Removing existing manifest file
Creating directory for command manifest file if it does not exist
Creating a manifest file...
Node Build Command Manifest file created.

Using Node version:
v16.18.0

Using Npm version:
8.19.2

Running 'npm install --unsafe-perm'...


added 119 packages, and audited 120 packages in 4s

26 packages are looking for funding
run `npm fund` for details

found 0 vulnerabilities

Running 'npm run build'...


> <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="ea848f929e8099c7999e8b9e8389c79d8f8899839e8faadac4dbc4da" rel="noreferrer noopener nofollow">[email protected]</a> build
> next build && next export

info - Loaded env from /github/workspace/.env.local
Attention: Next.js now collects completely anonymous telemetry regarding usage.
This information is used to shape Next.js' roadmap and prioritize features.
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:
https://nextjs.org/telemetry

info - using build directory: /github/workspace/.next
Error: Could not find a production build in the '/github/workspace/.next' directory. Try building your app with 'next build' before starting the static export. https://nextjs.org/docs/messages/next-export-no-build-id
at /github/workspace/node_modules/next/dist/export/index.js:62:19
at async Span.traceAsyncFn (/github/workspace/node_modules/next/dist/trace/trace.js:79:20)


---End of Oryx build logs---
Oryx has failed to build the solution.

For further information, please visit the Azure Static Web Apps documentation at https://docs.microsoft.com/en-us/azure/static-web-apps/
If you believe this behavior is unexpected, please raise a GitHub issue at https://github.com/azure/static-web-apps/issues/
Exiting
0s

请让我知道如何解决这个问题。在提交之前我还运行了 npm run build 和 npm start 。谢谢

我期待帮助

最佳答案

1- 在 package.json 中指定节点版本和 npm 版本(您在本地使用的)

例如:

“引擎”:{“节点”:“14.17.4”,“npm”:“2013 年 14 月 6 日”}

2-在根目录上创建 .npmrc 文件,其中包含以下文本:

引擎严格=true

关于reactjs - 如何解决下一个js项目中的npm错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/74453313/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com