我尝试使用VSCode扩展Azure APP Service
将nodeJS,typescript项目部署到Azure部署插槽,但我收到以下错误: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://git@scm.infosysta.com: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
并重试,但没有成功 - 我还试图强制删除缓存
npm cache clean --force
并再次执行步骤1,但也没有成功
有什么问题吗?
1条答案
按热度按时间myzjeezk1#
信息:“ENOENT:没有这样的文件或目录”
这通常表示应用程序试图访问的文件或目录不存在。这可能是因为文件路径不正确或缺少任何包,或者部署槽中缺少文件。
检查以下故障排除步骤是否有助于您解决问题。
验证代码中的文件路径对于访问文件和目录是否有效,并检查文件或目录是否存在于应用程序尝试访问的路径中。
通过在项目的根目录中运行
npm install
来验证是否安装了所有必需的包。在诊断中检查错误的详细信息并解决问题:
我试图删除
node_modules
文件夹,package-lock.json
运行npm install
并再次尝试,但没有运气我还试图强制删除缓存npm cache clean --force
并再次执行步骤1,但也没有运气尝试以下命令:
然后删除
node_modules
文件夹和package-lock.json
文件,然后运行npm install
。我已经从VS代码创建并部署了一个项目到Azure Web App服务。*
应用程序已部署并在部署插槽中运行:*
结果: