azure 如何解决next js项目中npm错误

093gszye  于 2022-11-17  发布在  其他
关注(0)|答案(1)|浏览(148)

我是一个next js/react js项目。在我的本地,它运行得很好,页面上的任何更新也会在网站上更新。我已经用azure部署了这个项目,我的repo在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'...

> nextjs-static-website@0.1.0 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运行构建和npm启动之前作出提交。谢谢
我期待帮助

cbeh67ev

cbeh67ev1#

1-在package.json中指定节点版本和npm版本(在本地使用)
例如:
“引擎”:{“节点”:“14.17.4”、“国家预防性维护”:“2013年6月14日”}
2-在根目录中创建包含以下文本的.npmrc文件:
引擎严格=true

相关问题