为什么我在将React应用程序部署到Netlify时会卡住



我正在使用Netlify部署React应用程序。但它在部署时卡住了,几乎没有显示任何警告,这在本地并不重要。

我也尝试使用CI= npm run build命令,它确实成功部署了,但没有找到页面,这显示了";看起来你关注了一个断开的链接,或者输入了一个在此网站上不存在的URL">

为什么会发生这种情况?我该怎么解决这个问题?

10:13:44 AM: Verify run directory
10:13:45 AM: ​
10:13:45 AM: ────────────────────────────────────────────────────────────────
10:13:45 AM:   Netlify Build                                                 
10:13:45 AM: ────────────────────────────────────────────────────────────────
10:13:45 AM: ​
10:13:45 AM: ❯ Version
10:13:45 AM:   @netlify/build 27.18.1
10:13:45 AM: ​
10:13:45 AM: ❯ Flags
10:13:45 AM:   baseRelDir: true
10:13:45 AM:   buildId: 6327b4129c51cc1f43f77437
10:13:45 AM:   deployId: 6327b4129c51cc1f43f77439
10:13:45 AM: ​
10:13:45 AM: ❯ Current directory
10:13:45 AM:   /opt/build/repo/Final/dev
10:13:45 AM: ​
10:13:45 AM: ❯ Config file
10:13:45 AM:   No config file was defined: using default values.
10:13:45 AM: ​
10:13:45 AM: ❯ Context
10:13:45 AM:   production
10:13:45 AM: ​
10:13:45 AM: ────────────────────────────────────────────────────────────────
10:13:45 AM:   1. Build command from Netlify app                             
10:13:45 AM: ────────────────────────────────────────────────────────────────
10:13:45 AM: ​
10:13:45 AM: $ npm start
10:13:45 AM: npm WARN config tmp This setting is no longer used.  npm stores temporary files in a special
10:13:45 AM: npm WARN config location in the cache, and they are managed by
10:13:45 AM: npm WARN config     [`cacache`](http://npm.im/cacache).
10:13:45 AM: > dev@0.1.0 start
10:13:45 AM: > react-scripts start
10:13:46 AM: (node:1533) [DEP_WEBPACK_DEV_SERVER_ON_AFTER_SETUP_MIDDLEWARE] DeprecationWarning: 'onAfterSetupMiddleware' option is deprecated. Please use the 'setupMiddlewares' option.
10:13:46 AM: (Use `node --trace-deprecation ...` to show where the warning was created)
10:13:46 AM: (node:1533) [DEP_WEBPACK_DEV_SERVER_ON_BEFORE_SETUP_MIDDLEWARE] DeprecationWarning: 'onBeforeSetupMiddleware' option is deprecated. Please use the 'setupMiddlewares' option.
10:13:47 AM: Starting the development server...
10:13:47 AM: 
10:14:08 AM: Compiled with warnings.
10:14:08 AM: 
10:14:08 AM: [eslint]
10:14:08 AM: src/Homepage.jsx
10:14:08 AM:   Line 4:17:  'useState' is defined but never used  no-unused-vars
10:14:08 AM: src/Settings.jsx
10:14:08 AM:   Line 139:11:  'uploadAvatar2fb' is assigned a value but never used  no-unused-vars
10:14:08 AM: src/Signup.jsx
10:14:08 AM:   Line 66:21:  img elements must have an alt prop, either with meaningful text, or an empty string for decorative images  jsx-a11y/alt-text
10:14:08 AM: src/utils/firebase.js
10:14:08 AM:   Line 6:45:  'addDoc' is defined but never used  no-unused-vars
10:14:08 AM: Search for the keywords to learn more about each warning.
10:14:08 AM: To ignore, add // eslint-disable-next-line to the line before.
10:14:08 AM: WARNING in [eslint]
10:14:08 AM: src/Homepage.jsx
10:14:08 AM:   Line 4:17:  'useState' is defined but never used  no-unused-vars
10:14:08 AM: src/Settings.jsx
10:14:08 AM:   Line 139:11:  'uploadAvatar2fb' is assigned a value but never used  no-unused-vars
10:14:08 AM: src/Signup.jsx
10:14:08 AM:   Line 66:21:  img elements must have an alt prop, either with meaningful text, or an empty string for decorative images  jsx-a11y/alt-text
10:14:08 AM: src/utils/firebase.js
10:14:08 AM:   Line 6:45:  'addDoc' is defined but never used  no-unused-vars
10:14:08 AM: webpack compiled with 1 warning

确保您的存储库直接包含netlify.toml配置文件(或任何配置文件(。对我来说,它在嵌套文件夹中,如果在您的情况下是一样的,请将此文件夹添加到netlify中的Build设置中作为Base目录。屏幕截图

最新更新