项目部署到 azure"/>
使用 VSCode 中的 Azure App Service 扩展将 NodeJS > typescript 项目部署到 azure
我正在尝试使用 VSCode 扩展将 nodeJS、typescript 项目部署到 azure 部署槽
Azure APP Service
,但出现以下错误:ENOENT: no such file or directory
我的项目树
我的 package.json
{
"name": "otj_server_app",
"version": "1.0.0",
"description": "",
"main": "build/src/index.js",
"scripts": {
"build_typescript": "tsc",
"build_local": "cp config/config_local.json config/config.json",
"build_dev": "cp config/config_dev.json config/config.json",
"build_sit": "cp config/config_sit.json config/config.json",
"build_prod": "cp config/config_prod.json config/config.json",
"start": "tsc && nodemon build/src/index.js",
"clean": "rimraf build",
"build": "npm run clean && tsc"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"body-parser": "^1.20.0",
"cors": "^2.8.5",
"express": "^4.18.1",
"express-session": "^1.17.3",
"form-data": "^4.0.0",
"formidable": "^2.0.1",
"fs-extra": "^10.1.0",
"https": "^1.0.0",
"infosysta-typescript-core": "git+ssh://[email protected]:7999/ac/infosysta-typescript-core.git",
"oauth": "^0.10.0",
"random-string": "^0.2.0",
"request-promise": "^4.2.6",
"rimraf": "^5.0.0",
"socket.io": "^2.4.1",
"socket.io-client": "^2.3.0",
"typescript": "^4.8.3"
},
"devDependencies": {
"@types/cors": "^2.8.12",
"@types/express": "^4.17.14",
"@types/express-session": "^1.17.4",
"nodemon": "^2.0.19"
}
}
问题
我试过的
- 我试图删除
文件夹,node_modules
运行package-lock.json
并重试但没有运气npm install
- 我还尝试强制删除缓存
并再次执行第1步但也没有运气npm cache clean --force
这里可能有什么问题?
回答如下:INFO:“ENOENT:没有这样的文件或目录”
这通常表示应用程序试图访问的文件或目录不存在。这可能是因为文件路径不正确或任何丢失的包或文件在部署槽中丢失。
检查以下故障排除步骤是否可以帮助您解决问题。
验证代码中的文件路径是否有效以访问文件和目录,并检查文件或目录是否存在于应用程序试图访问的路径中。
通过在项目的根目录中运行
来验证是否安装了所有必需的包。npm install
在诊断和解决问题中查看错误详情:
- 我试图删除
文件夹,node_modules
运行package-lock.json
并重试但没有运气 我也试图强制删除缓存npm install
并再次执行步骤1但也没有运气npm cache clean --force
- 尝试以下命令:
npm install
npm cache clean --force
npm install -g npm
npm install
在此之后删除
node_modules
文件夹和package-lock.json
文件,然后运行npm install
.
如果这些步骤都不起作用,请尝试创建一个新的部署槽并将您的应用程序部署到新槽。这有时可以帮助解决部署过程中的问题。
如果你正在部署 Typescript Azure 函数,我建议你更喜欢部署到函数应用程序而不是 Web 应用程序。当我尝试将我的函数部署到 Azure Web 应用程序服务时,我也遇到了同样的错误。
我已经从 VS 代码创建并部署了一个项目到 Azure Web App 服务。
应用程序已部署并在部署槽中运行: 结果:
更多推荐
使用 VSCode 中的 Azure App Service 扩展将 NodeJS > typescript 项目部署到 azure
发布评论