如何正确发布Expo:Web Build to NetLify to Github
我拥有用Expo Framework编写的Typescript RN应用程序,以前已将其连接到NetLify,但我曾经运行Expo Build:Web局部和NetLify Deplotion -prod。而且奏效了 现在,我想使用托管NetLify Workfow进行同样的操作。我已经将存储库与netlify连接了,部署设置是:
Base directory: Not set
Build command: expo build:web
Publish directory: web-build
Builds: Active
我已经准备好尝试了此thead NetLify部署:阶段'构建站点'期间失败:构建脚本返回非零退出代码:2 ,它行不通。
我的package.json是
{
"name": "health-check-app",
"version": "1.0.0",
"main": "node_modules/expo/AppEntry.js",
"homepage": "https://testreminder.com/",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"eject": "expo eject"
},
"dependencies": {
"@expo-google-fonts/italiana": "^0.2.0",
"@expo-google-fonts/lexend-deca": "^0.2.2",
"@expo-google-fonts/poppins": "^0.2.0",
"@react-google-maps/api": "^2.7.0",
"@react-navigation/native": "^6.0.6",
"@react-navigation/native-stack": "^6.2.5",
"@react-navigation/stack": "^6.0.11",
"@reduxjs/toolkit": "^1.7.2",
"@types/react-redux": "^7.1.22",
"dotenv": "^14.2.0",
"expo": "~44.0.0",
"expo-app-loading": "~1.3.0",
"expo-cli": "^5.4.9",
"expo-font": "~10.0.4",
"expo-linking": "~3.0.0",
"expo-location": "~14.0.1",
"expo-status-bar": "~1.2.0",
"expo-updates": "~0.11.7",
"firebase": "^9.6.3",
"geofire-common": "^5.2.0",
"react": "17.0.1",
"react-dom": "^17.0.1",
"react-hook-form": "^7.22.5",
"react-native": "0.64.3",
"react-native-dropdown-picker": "^5.4.2",
"react-native-elements": "^3.4.2",
"react-native-gesture-handler": "~2.1.0",
"react-native-maps": "0.29.4",
"react-native-maps-directions": "^1.8.0",
"react-native-reanimated": "~2.3.1",
"react-native-safe-area-context": "3.3.2",
"react-native-screens": "~3.10.1",
"react-native-svg": "12.1.1",
"react-native-uuid": "^2.0.1",
"react-native-web": "^0.17.1",
"react-native-web-swiper": "^2.2.3",
"react-native-webview": "11.15.0",
"react-redux": "^7.2.6"
},
"devDependencies": {
"@babel/core": "^7.12.9",
"@expo/config": "^6.0.16",
"@types/react": "~17.0.21",
"@types/react-native": "~0.64.12",
"typescript": "~4.3.5"
},
"private": true
}
,我的失败部署日志说:
4:45:07 PM: Build ready to start
4:45:09 PM: build-image version: d2c6dbeac570350a387d832f64bc980dc964ad65 (focal)
4:45:09 PM: build-image tag: v4.8.0
4:45:09 PM: buildbot version: d7330f24833f29d0263d28116347ab83094a2561
4:45:10 PM: Fetching cached dependencies
4:45:10 PM: Failed to fetch cache, continuing with build
4:45:10 PM: Starting to prepare the repo for build
4:45:10 PM: No cached dependencies found. Cloning fresh repo
4:45:10 PM: git clone https://github.com/Xfaang/testreminder
4:45:11 PM: Preparing Git Reference refs/heads/main
4:45:11 PM: Parsing package.json dependencies
4:45:12 PM: Starting build script
4:45:12 PM: Installing dependencies
4:45:12 PM: Python version set to 2.7
4:45:13 PM: Downloading and installing node v16.15.1...
4:45:13 PM: Downloading https://nodejs.org/dist/v16.15.1/node-v16.15.1-linux-x64.tar.xz...
4:45:14 PM: Computing checksum with sha256sum
4:45:14 PM: Checksums matched!
4:45:16 PM: Now using node v16.15.1 (npm v8.11.0)
4:45:16 PM: Started restoring cached build plugins
4:45:16 PM: Finished restoring cached build plugins
4:45:16 PM: Attempting ruby version 2.7.2, read from environment
4:45:18 PM: Using ruby version 2.7.2
4:45:18 PM: Using PHP version 8.0
4:45:18 PM: No npm workspaces detected
4:45:18 PM: Started restoring cached node modules
4:45:18 PM: Finished restoring cached node modules
4:45:19 PM: Installing NPM modules using NPM version 8.11.0
4:45:19 PM: npm WARN config tmp This setting is no longer used. npm stores temporary files in a special
4:45:19 PM: npm WARN config location in the cache, and they are managed by
4:45:19 PM: npm WARN config [`cacache`](http://npm.im/cacache).
4:45:19 PM: npm WARN config tmp This setting is no longer used. npm stores temporary files in a special
4:45:19 PM: npm WARN config location in the cache, and they are managed by
4:45:19 PM: npm WARN config [`cacache`](http://npm.im/cacache).
4:45:33 PM: npm WARN deprecated [email protected]: See https://github.com/lydell/source-map-resolve#deprecated
4:45:33 PM: npm WARN deprecated [email protected]: See https://github.com/lydell/source-map-url#deprecated
4:45:33 PM: npm WARN deprecated [email protected]: https://github.com/lydell/resolve-url#deprecated
4:45:45 PM: npm WARN deprecated [email protected]: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
4:45:51 PM: npm WARN deprecated [email protected]: The `subscriptions-transport-ws` package is no longer maintained. We recommend you use `graphql-ws` instead. For help migrating Apollo software to `graphql-ws`, see https://www.apollographql.com/docs/apollo-server/data/subscriptions/#switching-from-subscriptions-transport-ws For general help using `graphql-ws`, see https://github.com/enisdenjo/graphql-ws/blob/master/README.md
4:45:52 PM: npm WARN deprecated [email protected]: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
4:45:53 PM: npm WARN deprecated [email protected]: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
4:45:55 PM: npm WARN deprecated [email protected]: This SVGO version is no longer supported. Upgrade to v2.x.x.
4:45:57 PM: npm WARN deprecated [email protected]: Please see https://github.com/lydell/urix#deprecated
4:45:57 PM: npm WARN deprecated [email protected]: some dependency vulnerabilities fixed, support for node < 10 dropped, and newer ECMAScript syntax/features added
4:46:00 PM: npm WARN deprecated [email protected]: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
4:46:02 PM: npm WARN deprecated [email protected]: support for ECMAScript is superseded by `uglify-js` as of v3.13.0
4:46:03 PM: npm WARN deprecated [email protected]: This package has been deprecated and now it only exports makeExecutableSchema.\nAnd it will no longer receive updates.\nWe recommend you to migrate to scoped packages such as @graphql-tools/schema, @graphql-tools/utils and etc.\nCheck out https://www.graphql-tools.com to learn what package you should use instead
4:46:14 PM: npm WARN deprecated [email protected]: core-js@<3.4 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
4:46:40 PM: added 2033 packages, and audited 2034 packages in 1m
4:46:40 PM: 138 packages are looking for funding
4:46:40 PM: run `npm fund` for details
4:46:41 PM: 50 vulnerabilities (5 low, 4 moderate, 35 high, 6 critical)
4:46:41 PM: To address issues that do not require attention, run:
4:46:41 PM: npm audit fix
4:46:41 PM: To address all issues (including breaking changes), run:
4:46:41 PM: npm audit fix --force
4:46:41 PM: Run `npm audit` for details.
4:46:41 PM: NPM modules installed
4:46:41 PM: npm WARN config tmp This setting is no longer used. npm stores temporary files in a special
4:46:41 PM: npm WARN config location in the cache, and they are managed by
4:46:41 PM: npm WARN config [`cacache`](http://npm.im/cacache).
4:46:41 PM: Started restoring cached go cache
4:46:41 PM: Finished restoring cached go cache
4:46:41 PM: Installing Go version 1.17
4:46:47 PM: unset GOOS;
4:46:47 PM: unset GOARCH;
4:46:47 PM: export GOROOT='/opt/buildhome/.gimme_cache/versions/go1.17.linux.amd64';
4:46:47 PM: export PATH="/opt/buildhome/.gimme_cache/versions/go1.17.linux.amd64/bin:${PATH}";
4:46:47 PM: go version >&2;
4:46:47 PM: export GIMME_ENV="/opt/buildhome/.gimme_cache/env/go1.17.linux.amd64.env"
4:46:47 PM: go version go1.17 linux/amd64
4:46:47 PM: Installing missing commands
4:46:47 PM: Verify run directory
4:46:48 PM:
4:46:48 PM: ────────────────────────────────────────────────────────────────
4:46:48 PM: Netlify Build
4:46:48 PM: ────────────────────────────────────────────────────────────────
4:46:48 PM:
4:46:48 PM: ❯ Version
4:46:48 PM: @netlify/build 27.1.3
4:46:48 PM:
4:46:48 PM: ❯ Flags
4:46:48 PM: baseRelDir: true
4:46:48 PM: buildId: 62a358db3df69d0008ff51d5
4:46:48 PM: deployId: 62a358db3df69d0008ff51d7
4:46:48 PM:
4:46:48 PM: ❯ Current directory
4:46:48 PM: /opt/build/repo
4:46:48 PM:
4:46:48 PM: ❯ Config file
4:46:48 PM: No config file was defined: using default values.
4:46:48 PM:
4:46:48 PM: ❯ Context
4:46:48 PM: production
4:46:48 PM:
4:46:48 PM: ────────────────────────────────────────────────────────────────
4:46:48 PM: 1. Build command from Netlify app
4:46:48 PM: ────────────────────────────────────────────────────────────────
4:46:48 PM:
4:46:48 PM: $ expo build:web
4:46:50 PM: [14:46:50] Failed to compile.
4:46:50 PM: [14:46:50]
4:46:50 PM: [14:46:50] ./App.tsx
4:46:50 PM: Cannot find file './screens' in './'.
4:46:50 PM:
4:46:50 PM: ────────────────────────────────────────────────────────────────
4:46:50 PM: "build.command" failed
4:46:50 PM: ────────────────────────────────────────────────────────────────
4:46:50 PM:
4:46:50 PM: Error message
4:46:50 PM: Command failed with exit code 1: expo build:web (https://ntl.fyi/exit-code-1)
4:46:50 PM:
4:46:50 PM: Error location
4:46:50 PM: In Build command from Netlify app:
4:46:50 PM: expo build:web
4:46:50 PM:
4:46:50 PM: Resolved config
4:46:50 PM: build:
4:46:50 PM: command: expo build:web
4:46:50 PM: commandOrigin: ui
4:46:50 PM: publish: /opt/build/repo/web-build
4:46:50 PM: publishOrigin: ui
4:46:51 PM: Caching artifacts
4:46:51 PM: Started saving node modules
4:46:51 PM: Finished saving node modules
4:46:51 PM: Started saving build plugins
4:46:51 PM: Finished saving build plugins
4:46:51 PM: Started saving pip cache
4:46:51 PM: Finished saving pip cache
4:46:51 PM: Started saving emacs cask dependencies
4:46:51 PM: Finished saving emacs cask dependencies
4:46:51 PM: Started saving maven dependencies
4:46:51 PM: Finished saving maven dependencies
4:46:51 PM: Started saving boot dependencies
4:46:51 PM: Finished saving boot dependencies
4:46:51 PM: Started saving rust rustup cache
4:46:51 PM: Finished saving rust rustup cache
4:46:51 PM: Started saving go dependencies
4:46:52 PM: Finished saving go dependencies
4:46:53 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
4:46:53 PM: Creating deploy upload records
4:46:54 PM: Failing build: Failed to build site
4:46:54 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
4:46:54 PM: Finished processing build request in 1m44.263276891s
我已经安装了expo-cli,并且在本地正确构建,在netlify上,它似乎缺少有效的路径 感谢您帮助我。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论