我已經在SO上梳理了幾天,嘗試了各種方法,但就是不能讓它發揮作用。 我通常是一個 .Net 開發人員,我繼承了這一點,所以我在這里有點不在我的作業范圍內。
我按照這個教程走到了現在。https://websitebeaver.com/deploy-create-react-app-to-azure-app-services
在我的筆記本電腦上進行npm啟動時,它構建并加載到Chrome中,但在運行我的作業流程時,我在npm安裝、構建和測驗步驟中收到以下錯誤:
TypeScript error in /home/runner/work/node_modules/@types/invariant/index. d.ts(16,68) 。
';'預期。 TS1005
14 | 介面 InvariantStatic {
15 | (testValue: false, format: string, ...extra: any[]) : never;
> 16 | (testValue: any, format: string, ...extra: any[]): 斷言testValue;
| ^
17 | }
18 | }
19 !
npm ERR!代碼ELIFECYCLE
npm ERR! errno 1 !
npm ERR! test-portal@1.00 build: `react-scripts build --prod`
npm ERR! 退出狀態1。
npm ERR!
npm ERR! 在test-portal@1.0.0構建腳本時失敗了。
npm ERR! 這是可能不是問題與 npm。是上面可能有額外的日志輸出。
我的YAML檔案用于此:
on:
push:/span>
types: [created]
workflow_dispatch:/span> 作業流_dispatch:/span>
env:] Workflow_dispatch:
AZURE_WEBAPP_NAME: Portal-Test # 將此設定為你的應用程式的名稱。
AZURE_WEBAPP_PACKAGE_PATH: "build" # 將此設定為你的Web應用專案的路徑,默認為倉庫根目錄。
NODE_VERSION: "10.x" # 把這個設定為要使用的節點版本。
jobs:
build-and-deploy:
name: Build and Deploy
運行于: ubuntu-latest
環境: 生產
步驟:
- 用途: actions/checkout@v2
- name: Use Node.js 14
用途: actions/setup-node@v2
與:
節點-版本: '14'
- name: npm install, build, and test
運行: ||
# 構建并測驗該專案,然后
# 部署到Azure Web App。
npm安裝
npm run build --if-present
npm run test --if-present
- name: "Deploy to Azure WebApp"
用途: azure/webapps-deploy@v2
與:
app-name: ${{ env.AZURE_WEBAPP_NAME }}
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}
package: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }
而我的package.json
{
"name"。"Portal-Test"。
"版本": "1.0.0",
"私有": true,
"dependencies": {
"@capacitor/android": "^1.4.0",
"@capacitor/core": "1.3.0",
"@ionic-native/core": "^5.23.0",
"@ionic-native/in-app-browser": "^5.23.0",
"@ionic/react": "^4.11.0",
"@ionic/react-router": "^4.11.0",
"@nivo/pie": "^0.61.1",
"@types/jest": "^24.0.18",
"@types/node": "^12.7.12",
"@types/react": "^16.9.5",
"@types/react-dom": "^16.9.1",
"@types/react-router": "^5.1.1",
"@types/react-router-dom": "^5.1.0",
"chart.js": "^2.9.3",
"connected-react-router": "^6.8.0",
"cordova-plugin-inappbrowser": "^3.2.0",
"http-proxy-middleware": "^1.0.4",
"ionicons": "^4.6.3",
"node-sass": "^4.14.0",
"react": "^16.10.2",
"react-bootstrap": "最新"。
"react-chartjs-2": "^2.8.0",
"react-dom": "^16.10.2",
"react-redux": "^7.2.0",
"react-router": "^5.1.0",
"react-router-dom": "^5.1.0",
"react-router-redux": "^4.0.8",
"react-scripts": "^3.4.0",
"react-spinners": "^0.8.3",
"react-toastify": "^6.0.4",
"react-toastify-redux": "^1.0.0-rc.2",
"redux": "^4.0.5",
"redux-devtools-extension": "^2.13.8",
"redux-saga": "^1.1.3",
"redux-saga-router": "^2.2.0",
"tslint": "^5.20.1",
"typesafe-actions": "^5.1.0",
"typescript": "3.6.3".
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build --prod"。
"test": "react-scripts test"。
"eject": "react-scripts eject"。
},
"eslintConfig": {
"extends": "react-app"。
},
"browserslist": {
"production": [
">0.2%",
"not dead"。
"not op_mini all"
],
"development"。[
"last 1 chrome version" 。
"last 1 firefox version",
"last 1 safari版本"
]
}
the tsconfig.json
{
"compilerOptions": {
"target": "es5",
"lib": []。
"dom",
"dom.iterable"/span>,
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": false,
"forceConsistentCasingInFileNames": true,
"模塊": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "reaction",
"baseUrl": " ./src"
},
"include": ["src"],
"exclude"。 ["node_modules", "lib"]/span>
]
}
uj5u.com熱心網友回復:
添加到你的tsconfig
。"compilerOptions": {
"types": [],
"skipLibCheck": true
},
"exclude"/span>。 ["node_modules", "lib"]
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/319803.html
標籤:
