azure部署问题缺少server.js/app.js文件

ohfgkhjo  于 2021-06-20  发布在  Kudu
关注(0)|答案(1)|浏览(450)

我正在尝试在azure web app上部署我的代码
我的package.json文件是:

{
  "name": "blur_admin",
  "version": "1.3.1",
  "devDependencies": {
    "browser-sync": "~2.18.2",
    "browser-sync-spa": "~1.0.3",
    "chalk": "~1.1.1",
    "del": "~2.2.2",
    "eslint-plugin-angular": "~0.12.0",
    "estraverse": "~4.2.0",
    "gulp": "~3.9.0",
    "gulp-angular-filesort": "~1.1.1",
    "gulp-angular-templatecache": "~2.0.0",
    "gulp-autoprefixer": "~3.1.1",
    "gulp-eslint": "~1.0.0",
    "gulp-filter": "~4.0.0",
    "gulp-flatten": "~0.3.1",
    "gulp-gh-pages": "^0.5.4",
    "gulp-inject": "~4.1.0",
    "gulp-load-plugins": "~1.4.0",
    "gulp-minify-css": "~1.2.1",
    "gulp-minify-html": "~1.0.4",
    "gulp-ng-annotate": "~2.0.0",
    "gulp-prompt": "^0.2.0",
    "gulp-protractor": "~3.0.0",
    "gulp-rename": "^1.2.2",
    "gulp-replace": "~0.5.4",
    "gulp-rev": "~7.1.2",
    "gulp-rev-replace": "~0.4.2",
    "gulp-sass": "~2.3.2",
    "gulp-shell": "^0.5.2",
    "gulp-size": "~2.1.0",
    "gulp-sourcemaps": "~1.6.0",
    "gulp-uglify": "~2.0.0",
    "gulp-useref": "~1.3.0",
    "gulp-util": "~3.0.6",
    "gulp-zip": "^3.0.2",
    "http-proxy-middleware": "~0.17.2",
    "lodash": "~4.17.2",
    "main-bower-files": "~2.13.1",
    "uglify-save-license": "~0.4.1",
    "wiredep": "~4.0.0",
    "wrench": "~1.5.8"
  },

  "engines": {
    "node": "6.11.2",
    "npm": "5.0.3"
  },
  "dependencies": {
    "lodash": "^4.17.4",
    "moment": "^2.18.1"
  }
}

我的deploy.cmd文件是

@if "%SCM_TRACE_LEVEL%" NEQ "4" @echo off

:: ----------------------
:: KUDU Deployment Script
:: Version: 1.0.15
:: ----------------------

:: Prerequisites
:: -------------

:: Verify node.js installed
where node 2>nul >nul
IF %ERRORLEVEL% NEQ 0 (
  echo Missing node.js executable, please install node.js, if already installed make sure it can be reached from current environment.
  goto error
)

:: Setup
:: -----

setlocal enabledelayedexpansion

SET ARTIFACTS=%~dp0%..\artifacts

IF NOT DEFINED DEPLOYMENT_SOURCE (
  SET DEPLOYMENT_SOURCE=%~dp0%.
)

IF NOT DEFINED DEPLOYMENT_TARGET (
  SET DEPLOYMENT_TARGET=%ARTIFACTS%\wwwroot
)

IF NOT DEFINED NEXT_MANIFEST_PATH (
  SET NEXT_MANIFEST_PATH=%ARTIFACTS%\manifest

  IF NOT DEFINED PREVIOUS_MANIFEST_PATH (
    SET PREVIOUS_MANIFEST_PATH=%ARTIFACTS%\manifest
  )
)

IF NOT DEFINED KUDU_SYNC_CMD (
  :: Install kudu sync
  echo Installing Kudu Sync
  call npm install kudusync -g --silent
  IF !ERRORLEVEL! NEQ 0 goto error

  :: Locally just running "kuduSync" would also work
  SET KUDU_SYNC_CMD=%appdata%\npm\kuduSync.cmd
)
goto Deployment

:: Utility Functions
:: -----------------

:SelectNodeVersion

IF DEFINED KUDU_SELECT_NODE_VERSION_CMD (
  :: The following are done only on Windows Azure Websites environment
  call %KUDU_SELECT_NODE_VERSION_CMD% "%DEPLOYMENT_SOURCE%" "%DEPLOYMENT_TARGET%" "%DEPLOYMENT_TEMP%"
  IF !ERRORLEVEL! NEQ 0 goto error

  IF EXIST "%DEPLOYMENT_TEMP%\__nodeVersion.tmp" (
    SET /p NODE_EXE=<"%DEPLOYMENT_TEMP%\__nodeVersion.tmp"
    IF !ERRORLEVEL! NEQ 0 goto error
  )

  IF EXIST "%DEPLOYMENT_TEMP%\__npmVersion.tmp" (
    SET /p NPM_JS_PATH=<"%DEPLOYMENT_TEMP%\__npmVersion.tmp"
    IF !ERRORLEVEL! NEQ 0 goto error
  )

  IF NOT DEFINED NODE_EXE (
    SET NODE_EXE=node
  )

  SET NPM_CMD="!NODE_EXE!" "!NPM_JS_PATH!"
) ELSE (
  SET NPM_CMD=npm
  SET NODE_EXE=node
)

goto :EOF

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Deployment
:: ----------

:Deployment
echo Handling node.js deployment.

:: 1. Select node version
call :SelectNodeVersion

:: 2. Install npm packages
IF EXIST "%DEPLOYMENT_SOURCE%\package.json" (
  call :ExecuteCmd !NPM_CMD! install
  IF !ERRORLEVEL! NEQ 0 goto error
)

:: 3. Execute Gulp
IF EXIST "%DEPLOYMENT_SOURCE%\gulpfile.js" (
    call .\node_modules\.bin\gulp serve:dist
    IF !ERRORLEVEL! NEQ 0 goto error
)

:: 4. KuduSync
IF /I "%IN_PLACE_DEPLOYMENT%" NEQ "1" (
  call :ExecuteCmd "%KUDU_SYNC_CMD%" -v 50 -f "%DEPLOYMENT_SOURCE%\dist" -t "%DEPLOYMENT_TARGET%" -n "%NEXT_MANIFEST_PATH%" -p "%PREVIOUS_MANIFEST_PATH%" -i ".git;.hg;.deployment;deploy.cmd"
  IF !ERRORLEVEL! NEQ 0 goto error
)

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
goto end

:: Execute command routine that will echo out when error
:ExecuteCmd
setlocal
set _CMD_=%*
call %_CMD_%
if "%ERRORLEVEL%" NEQ "0" echo Failed exitCode=%ERRORLEVEL%, command=%_CMD_%
exit /b %ERRORLEVEL%

:error
endlocal
echo An error has occurred during web site deployment.
call :exitSetErrorLevel
call :exitFromFunction 2>nul

:exitSetErrorLevel
exit /b 1

:exitFromFunction
()

:end
endlocal
echo Finished successfully.

网站部署期间出错。子目录或文件d:\home\site\repository\lib已存在。\r\n缺少server.js/app.js文件,不会生成web.config\r\nnpm警告生命周期用于脚本的节点二进制文件是d:\program files(x86)\nodejs\6.9.1\node.exe,但npm使用的是d:\program files(x86)\nodejs\6.11.2\node.exe本身。使用 --scripts-prepend-node-path 包含节点二进制npm路径的选项已与一起执行。\r\nnpm warnblur_admin@1.3.1 没有存储库字段。\r\nnpm warnblur_admin@1.3.1 没有许可证字段。\r\nnpm warn包lodash同时作为开发和生产依赖项包含。\r\n\r\nnpm warn已弃用bower@1.8.2:…嘘!您的项目可以随时停止工作,因为它的依赖关系可能会更改。通过迁移到Yarn来防止这种情况:https://bower.io/blog/2017/how-to-migrate-away-from-bower/\r\nnpm警告生命周期用于脚本的节点二进制文件是d:\program files(x86)\nodejs\6.9.1\node.exe,但npm使用的是d:\program files(x86)\nodejs\6.11.2\node.exe本身。使用 --scripts-prepend-node-path 包含节点二进制npm路径的选项是用执行的。\r\n'node\u modules.bin\bower'不能识别为内部或外部命令,\r\n可操作程序或批处理文件。\r\n(node:11612)UnhandledPromisejectionWarning:未处理的承诺拒绝(拒绝id:1):错误:错误:未安装jquery。试着跑步 bower install 或从bower.json文件中删除该组件。\r\nd:\program files(x86)\siteextensions\kudu\67.61027.3099\bin\scripts\starter.cmd deploy.cmd
我已经试了好几天了,但是解决不了这个问题,有人能帮忙吗?短暂性脑缺血发作

e0uiprwp

e0uiprwp1#

node.js版本 6.11.2 您在 package.json azure应用程序服务不支持。你可以把它改成 6.9.5 或任何其他可用的。
您可以在url上看到azure支持的所有node.js版本 https://<yourappname>.scm.azurewebsites.net/api/diagnostics/runtime

相关问题