Microsoft Azure持续集成 – 使用Grunt“编译”步骤的NodeJs解决scheme

我的问题的一些前兆。

我可能会有一些详细的细节,但我只是想确保我不会遗漏任何可能导致我的问题。 (我会在问题的末尾附上完整的错误日志,但是我不希望任何人对此有太大的反应,我会尽可能地总结一下)

  1. 我使用Yeoman支撑了一个AngularJS项目。使用yo angular命令。
  2. 然后我创build了deploy.cmd.deployment文件
  3. 推到我的Git仓库上的Bitbucket。 (只提交根文件夹文件,testing和应用程序文件夹)
  4. 从那里,通过他们的网站快速设置链接到Azure。
  5. 我的版本分成两部分,在部署期间安装grunt和bower(全局),然后在npm软件包安装期间安装grunt软件包
  6. 然后我需要尝试运行grunt build成为POST_DEPLOYMENT_ACTION

package.json (prod依赖)

  "dependencies": { "grunt": "^0.4.1", "grunt-autoprefixer": "^0.7.3", "grunt-concurrent": "^0.5.0", "grunt-contrib-clean": "^0.5.0", "grunt-contrib-concat": "^0.4.0", "grunt-contrib-copy": "^0.5.0", "grunt-contrib-cssmin": "^0.9.0", "grunt-contrib-htmlmin": "^0.3.0", "grunt-contrib-imagemin": "^0.8.1", "grunt-contrib-jshint": "^0.10.0", "grunt-contrib-uglify": "^0.4.0", "grunt-filerev": "^0.2.1", "grunt-google-cdn": "^0.4.0", "grunt-newer": "^0.7.0", "grunt-ng-annotate": "^0.3.0", "grunt-svgmin": "^0.4.0", "grunt-usemin": "^2.1.1", "grunt-wiredep": "^1.7.0", "jshint-stylish": "^0.2.0", "load-grunt-tasks": "^0.4.0", "time-grunt": "^0.3.1" }, 

deployment.cmd (为简洁起见省略了一些部分)

 :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: Deployment :: ---------- :Deployment echo Handling node.js deployment. :: 1. Select node version call :SelectNodeVersion :: 2. Install bower packages IF EXIST "%DEPLOYMENT_TARGET%\bower.json" ( echo installing bower call :ExecuteCmd !NPM_CMD! install -g bower IF !ERRORLEVEL! NEQ 0 goto error echo installing bower success popd ) :: 3. Install Grunt IF EXIST "%DEPLOYMENT_TARGET%\Gruntfile.js" ( echo installing grunt-cli call :ExecuteCmd !NPM_CMD! install -g grunt-cli IF !ERRORLEVEL! NEQ 0 goto error echo installing grunt-cli success popd ) :: 4. Install npm packages IF EXIST "%DEPLOYMENT_TARGET%\package.json" ( echo installing npm packages pushd "%DEPLOYMENT_TARGET%" call :ExecuteCmd !NPM_CMD! install --production IF !ERRORLEVEL! NEQ 0 goto error echo installing npm packages popd ) :: 5. KuduSync IF /I "%IN_PLACE_DEPLOYMENT%" NEQ "1" ( call :ExecuteCmd "%KUDU_SYNC_CMD%" -v 50 -f "%DEPLOYMENT_SOURCE%" -t "%DEPLOYMENT_TARGET%" -n "%NEXT_MANIFEST_PATH%" -p "%PREVIOUS_MANIFEST_PATH%" -i ".git;.hg;.deployment;deploy.cmd" IF !ERRORLEVEL! NEQ 0 goto error ) :: Post deployment stub IF DEFINED POST_DEPLOYMENT_ACTION ( echo "%POST_DEPLOYMENT_ACTION%" echo %0 call :ExecuteCmd "%POST_DEPLOYMENT_ACTION%" IF !ERRORLEVEL! NEQ 0 goto error ) 

我有两个问题:因为它的立场我的构build失败,出现以下错误:

错误:指定的path,文件名或这两者太长。 完全限定的文件名必须less于260个字符,且目录名称必须less于248个字符。

我相信咕噜/它的一些依赖是罪魁祸首,但我不知道如何克服这个障碍。 我理解节点中依赖pipe理如何工作的方式是它的嵌套结构,每个依赖将有自己的node_modules文件夹…到无穷远以及超越。

第二个问题

在站点根目录下寻找app.js / server.js。

缺lessserver.js / app.js文件,web.config不会生成

我意识到app.js不在根目录中。 我相信这很容易修改设置更改,但是我只能在Azure上编译解决scheme时执行此操作,因为app.js将位于名为dist的文件夹中,编译成功后会创build该文件夹。

完整的错误日志

  Command: deploy.cmd Using custom deployment setting for POST_DEPLOYMENT_ACTION custom value is 'grunt build'. Handling node.js deployment. Looking for app.js/server.js under site root. Missing server.js/app.js files, web.config is not generated Node.js versions available on the platform are: 0.6.17, 0.6.20, 0.8.2, 0.8.19, 0.8.26, 0.8.27, 0.8.28, 0.10.5, 0.10.18, 0.10.21, 0.10.24, 0.10.26, 0.10.28, 0.10.29, 0.10.31, 0.10.32. Selected node.js version 0.10.32. Use package.json file to choose a different version. Updating iisnode.yml at D:\home\site\wwwroot\iisnode.yml installing bower C:\DWASFiles\Sites\~1businessintelligenceadviser\AppData\npm\bower -> C:\DWASFiles\Sites\~1businessintelligenceadviser\AppData\npm\node_modules\bower\bin\bower bower@1.3.12 C:\DWASFiles\Sites\~1businessintelligenceadviser\AppData\npm\node_modules\bower ├── is-root@1.0.0 ├── junk@1.0.0 ├── stringify-object@1.0.0 ├── abbrev@1.0.5 ├── chmodr@0.1.0 ├── which@1.0.5 ├── osenv@0.1.0 ├── archy@0.0.2 ├── opn@1.0.0 ├── rimraf@2.2.8 ├── bower-logger@0.2.2 ├── lru-cache@2.5.0 ├── bower-endpoint-parser@0.2.2 ├── graceful-fs@3.0.4 ├── lockfile@1.0.0 ├── retry@0.6.0 ├── nopt@3.0.1 ├── tmp@0.0.23 ├── request-progress@0.3.0 (throttleit@0.0.2) ├── q@1.0.1 ├── shell-quote@1.4.2 (array-filter@0.0.1, array-reduce@0.0.0, array-map@0.0.0, jsonify@0.0.0) ├── chalk@0.5.0 (escape-string-regexp@1.0.2, ansi-styles@1.1.0, supports-color@0.2.0, strip-ansi@0.3.0, has-ansi@0.1.0) ├── semver@2.3.2 ├── fstream@1.0.2 (inherits@2.0.1) ├── bower-json@0.4.0 (intersect@0.0.3, deep-extend@0.2.11, graceful-fs@2.0.3) ├── p-throttler@0.1.0 (q@0.9.7) ├  ─ promptly@0.2.0 (read@1.0.5) ├── mkdirp@0.5.0 (minimist@0.0.8) ├── fstream-ignore@1.0.1 (inherits@2.0.1, minimatch@1.0.0) ├── bower-config@0.5.2 (osenv@0.0.3, graceful-fs@2.0.3, optimist@0.6.1) ├── tar-fs@0.5.2 (pump@0.3.5, tar-stream@0.4.7) ├── decompress-zip@0.0.8 (mkpath@0.1.0, nopt@2.2.1, touch@0.0.2, readable-stream@1.1.13, binary@0.3.0) ├── glob@4.0.6 (inherits@2.0.1, once@1.3.1, minimatch@1.0.0) ├── request@2.42.0 (caseless@0.6.0, json-stringify-safe@5.0.0, forever-agent@0.5.2, aws-sign2@0.5.0, stringstream@0.0.4, oauth-sign@0.4.0, tunnel-agent@0.4.0, node-uuid@1.4.1, qs@1.2.2, mime-types@1.0.2, form-data@0.1.4, bl@0.9.3, tough-cookie@0.12.1, http-signature@0.10.0, hawk@1.1.1) ├── bower-registry-client@0.2.1 (graceful-fs@2.0.3, request-replay@0.2.0, lru-cache@2.3.1, async@0.2.10, mkdirp@0.3.5, request@2.27.0) ├── cardinal@0.4.0 (redeyed@0.4.4) ├── update-notifier@0.2.0 (semver-diff@0.1.0, string-length@0.1.2, latest-version@0.2.0, configstore@0.3.1) ├── mout@0.9.1 ├── handlebars@2.0.0 (optimist@0.3.7, uglify-js@2.3.6) ├── inquirer@0.7.1 (figures@1.3.3, mute-stream@0.0.4, through@2.3.6, readline2@0.1.0, lodash@2.4.1, rx@2.3.14, cli-color@0.3.2) └── insight@0.4.3 (object-assign@1.0.0, async@0.9.0, chalk@0.5.1, os-name@1.0.1, lodash.debounce@2.4.1, tough-cookie@0.12.1, configstore@0.3.1, inquirer@0.6.0) installing bower success installing grunt-cli C:\DWASFiles\Sites\~1businessintelligenceadviser\AppData\npm\grunt -> C:\DWASFiles\Sites\~1businessintelligenceadviser\AppData\npm\node_modules\grunt-cli\bin\grunt grunt-cli@0.1.13 C:\DWASFiles\Sites\~1businessintelligenceadviser\AppData\npm\node_modules\grunt-cli ├── nopt@1.0.10 (abbrev@1.0.5) ├── resolve@0.3.1 └── findup-sync@0.1.3 (glob@3.2.11, lodash@2.4.1) installing grunt-cli success installing npm packages npm WARN package.json businessintelligenceadviser@0.0.0 No description npm WARN package.json businessintelligenceadviser@0.0.0 No repository field. npm WARN package.json businessintelligenceadviser@0.0.0 No README data npm WARN unmet dependency D:\home\site\wwwroot\node_modules\grunt-contrib-imagemin\node_modules\imagemin\node_modules\imagemin-gifsicle\node_modules\gifsicle\node_modules\bin-wrapper\node_modules\bin-check\node_modules\executable\node_modules\meow\node_modules\indent-string requires minimist@'^1.1.0' but will load npm WARN unmet dependency undefined, npm WARN unmet dependency which is version undefined npm WARN unmet dependency D:\home\site\wwwroot\node_modules\grunt-contrib-imagemin\node_modules\imagemin\node_modules\imagemin-gifsicle\node_modules\gifsicle\node_modules\bin-wrapper\node_modules\bin-check\node_modules\executable\node_modules\meow\node_modules\indent-string\node_modules\repeating\node_modules\meow requires minimist@'^1.1.0' but will load npm WARN unmet dependency undefined, npm WARN unmet dependency which is version undefined npm WARN unmet dependency D:\home\site\wwwroot\node_modules\grunt-contrib-imagemin\node_modules\imagemin\node_modules\imagemin-jpegtran\node_modules\jpegtran-bin\node_modules\bin-wrapper\node_modules\bin-version-check\node_modules\bin-version\node_modules\find-versions requires minimist@'^1.1.0' but will load npm WARN unmet dependency undefined, npm WARN unmet dependency which is version undefined npm WARN unmet dependency D:\home\site\wwwroot\node_modules\grunt-contrib-imagemin\node_modules\imagemin\node_modules\imagemin-jpegtran\node_modules\jpegtran-bin\node_modules\bin-wrapper\node_modules\download\node_modules\decompress-tar requires vinyl@'^0.4.3' but will load npm WARN unmet dependency undefined, installing npm packages npm WARN unmet dependency which is version undefined npm WARN unmet dependency D:\home\site\wwwroot\node_modules\grunt-contrib-imagemin\node_modules\imagemin\node_modules\imagemin-jpegtran\node_modules\jpegtran-bin\node_modules\bin-wrapper\node_modules\download\node_modules\decompress-tarbz2 requires vinyl@'^0.4.3' but will load npm WARN unmet dependency undefined, npm WARN unmet dependency which is version undefined npm WARN unmet dependency D:\home\site\wwwroot\node_modules\grunt-contrib-imagemin\node_modules\imagemin\node_modules\imagemin-jpegtran\node_modules\jpegtran-bin\node_modules\bin-wrapper\node_modules\download\node_modules\decompress-targz requires vinyl@'^0.4.3' but will load npm WARN unmet dependency undefined, npm WARN unmet dependency which is version undefined npm WARN unmet dependency D:\home\site\wwwroot\node_modules\grunt-contrib-imagemin\node_modules\imagemin\node_modules\imagemin-jpegtran\node_modules\jpegtran-bin\node_modules\bin-wrapper\node_modules\download\node_modules\decompress-unzip requires vinyl@'^0.4.3' but will load npm WARN unmet dependency undefined, npm WARN unmet dependency which is version undefined npm WARN unmet dependency D:\home\site\wwwroot\node_modules\grunt-contrib-imagemin\node_modules\imagemin\node_modules\imagemin-jpegtran\node_modules\jpegtran-bin\node_modules\bin-wrapper\node_modules\download\node_modules\vinyl-fs requires vinyl@'^0.4.0' but will load npm WARN unmet dependency undefined, npm WARN unmet dependency which is version undefined npm WARN unmet dependency D:\home\site\wwwroot\node_modules\grunt-contrib-imagemin\node_modules\imagemin\node_modules\imagemin-optipng\node_modules\optipng-bin\node_modules\bin-build\node_modules\download\node_modules\vinyl-fs\node_modules\glob-stream\node_modules\glob2base requires lodash@'^2.4.1' but will load npm WARN unmet dependency undefined, npm WARN unmet dependency which is version undefined npm WARN unmet dependency D:\home\site\wwwroot\node_modules\grunt-contrib-imagemin\node_modules\imagemin\node_modules\imagemin-optipng\node_modules\optipng-bin\node_modules\bin-wrapper\node_modules\bin-check\node_modules\executable\node_modules\meow\node_modules\indent-string requires minimist@'^1.1.0' but will load npm WARN unmet dependency undefined, npm WARN unmet dependency which is version undefined npm WARN unmet dependency D:\home\site\wwwroot\node_modules\grunt-contrib-imagemin\node_modules\imagemin\node_modules\imagemin-optipng\node_modules\optipng-bin\node_modules\bin-wrapper\node_modules\bin-check\node_modules\executable\node_modules\meow\node_modules\indent-string\node_modules\repeating\node_modules\meow requires minimist@'^1.1.0' but will load npm WARN unmet dependency undefined, npm WARN unmet dependency which is version undefined npm WARN unmet dependency D:\home\site\wwwroot\node_modules\grunt-contrib-imagemin\node_modules\imagemin\node_modules\imagemin-optipng\node_modules\optipng-bin\node_modules\bin-wrapper\node_modules\bin-version-check\node_modules\bin-version\node_modules\find-versions requires minimist@'^1.1.0' but will load npm WARN unmet dependency undefined, KuduSync.NET from: 'D:\home\site\repository' to: 'D:\home\site\wwwroot' Copying file: 'node_modules\grunt-autoprefixer\.travis.yml' npm WARN unmet dependency which is version undefined Copying file: 'node_modules\grunt-autoprefixer\CHANGELOG' npm WARN unmet dependency D:\home\site\wwwroot\node_modules\grunt-contrib-imagemin\node_modules\imagemin\node_modules\imagemin-pngquant\node_modules\pngquant-bin\node_modules\bin-build\node_modules\download\node_modules\meow\node_modules\indent-string requires minimist@'^1.1.0' but will load Copying file: 'node_modules\grunt-autoprefixer\LICENSE-MIT' npm WARN unmet dependency undefined, Copying file: 'node_modules\grunt-autoprefixer\package.json' npm WARN unmet dependency which is version undefined Copying file: 'node_modules\grunt-autoprefixer\README.md' npm WARN unmet dependency D:\home\site\wwwroot\node_modules\grunt-contrib-imagemin\node_modules\imagemin\node_modules\imagemin-pngquant\node_modules\pngquant-bin\node_modules\bin-wrapper\node_modules\bin-check\node_modules\executable\node_modules\meow\node_modules\indent-string requires minimist@'^1.1.0' but will load Copying file: 'node_modules\grunt-autoprefixer\node_modules\.bin\autoprefixer' Copying file: 'node_modules\grunt-autoprefixer\node_modules\.bin\autoprefixer.cmd' npm WARN unmet dependency undefined, Copying file: 'node_modules\grunt-autoprefixer\node_modules\autoprefixer\ChangeLog.md' npm WARN unmet dependency which is version undefined Copying file: 'node_modules\grunt-autoprefixer\node_modules\autoprefixer\LICENSE' npm WARN unmet dependency D:\home\site\wwwroot\node_modules\grunt-contrib-imagemin\node_modules\imagemin\node_modules\imagemin-pngquant\node_modules\pngquant-bin\node_modules\bin-wrapper\node_modules\bin-check\node_modules\executable\node_modules\meow\node_modules\indent-string\node_modules\repeating\node_modules\meow requires minimist@'^1.1.0' but will load Copying file: 'node_modules\grunt-autoprefixer\node_modules\autoprefixer\package.json' npm WARN unmet dependency undefined, Copying file: 'node_modules\grunt-autoprefixer\node_modules\autoprefixer\README.md' npm WARN unmet dependency which is version undefined Copying file: 'node_modules\grunt-autoprefixer\node_modules\autoprefixer\bin\autoprefixer' npm WARN unmet dependency D:\home\site\wwwroot\node_modules\grunt-contrib-imagemin\node_modules\imagemin\node_modules\imagemin-pngquant\node_modules\pngquant-bin\node_modules\bin-wrapper\node_modules\download\node_modules\meow\node_modules\indent-string requires minimist@'^1.1.0' but will load Copying file: 'node_modules\grunt-autoprefixer\node_modules\autoprefixer\data\browsers.js' npm WARN unmet dependency undefined, Copying file: 'node_modules\grunt-autoprefixer\node_modules\autoprefixer\data\prefixes.js' npm WARN unmet dependency which is version undefined Copying file: 'node_modules\grunt-autoprefixer\node_modules\autoprefixer\lib\autoprefixer.js' Copying file: 'node_modules\grunt-autoprefixer\node_modules\autoprefixer\lib\binary.js' Copying file: 'node_modules\grunt-autoprefixer\node_modules\autoprefixer\lib\browsers.js' Copying file: 'node_modules\grunt-autoprefixer\node_modules\autoprefixer\lib\caniuse.js' Copying file: 'node_modules\grunt-autoprefixer\node_modules\autoprefixer\lib\declaration.js' Copying file: 'node_modules\grunt-autoprefixer\node_modules\autoprefixer\lib\info.js' Copying file: 'node_modules\grunt-autoprefixer\node_modules\autoprefixer\lib\keyframes.js' Copying file: 'node_modules\grunt-autoprefixer\node_modules\autoprefixer\lib\old-selector.js' Copying file: 'node_modules\grunt-autoprefixer\node_modules\autoprefixer\lib\old-value.js' Copying file: 'node_modules\grunt-autoprefixer\node_modules\autoprefixer\lib\prefixer.js' Copying file: 'node_modules\grunt-autoprefixer\node_modules\autoprefixer\lib\prefixes.js' Copying file: 'node_modules\grunt-autoprefixer\node_modules\autoprefixer\lib\processor.js' Copying file: 'node_modules\grunt-autoprefixer\node_modules\autoprefixer\lib\selector.js' Copying file: 'node_modules\grunt-autoprefixer\node_modules\autoprefixer\lib\utils.js' Copying file: 'node_modules\grunt-autoprefixer\node_modules\autoprefixer\lib\value.js' Copying file: 'node_modules\grunt-autoprefixer\node_modules\autoprefixer\lib\hacks\align-content.js' Copying file: 'node_modules\grunt-autoprefixer\node_modules\autoprefixer\lib\hacks\align-items.js' Copying file: 'node_modules\grunt-autoprefixer\node_modules\autoprefixer\lib\hacks\align-self.js' Copying file: 'node_modules\grunt-autoprefixer\node_modules\autoprefixer\lib\hacks\background-size.js' Copying file: 'node_modules\grunt-autoprefixer\node_modules\autoprefixer\lib\hacks\border-image.js' Copying file: 'node_modules\grunt-autoprefixer\node_modules\autoprefixer\lib\hacks\border-radius.js' Copying file: 'node_modules\grunt-autoprefixer\node_modules\autoprefixer\lib\hacks\break-inside.js' Copying file: 'node_modules\grunt-autoprefixer\node_modules\autoprefixer\lib\hacks\display-flex.js' Copying file: 'node_modules\grunt-autoprefixer\node_modules\autoprefixer\lib\hacks\fill-available.js' Copying file: 'node_modules\grunt-autoprefixer\node_modules\autoprefixer\lib\hacks\filter.js' Copying file: 'node_modules\grunt-autoprefixer\node_modules\autoprefixer\lib\hacks\flex-basis.js' Copying file: 'node_modules\grunt-autoprefixer\node_modules\autoprefixer\lib\hacks\flex-direction.js' Copying file: 'node_modules\grunt-autoprefixer\node_modules\autoprefixer\lib\hacks\flex-flow.js' Copying file: 'node_modules\grunt-autoprefixer\node_modules\autoprefixer\lib\hacks\flex-grow.js' Copying file: 'node_modules\grunt-autoprefixer\node_modules\autoprefixer\lib\hacks\flex-shrink.js' Copying file: 'node_modules\grunt-autoprefixer\node_modules\autoprefixer\lib\hacks\flex-spec.js' Copying file: 'node_modules\grunt-autoprefixer\node_modules\autoprefixer\lib\hacks\flex-wrap.js' Copying file: 'node_modules\grunt-autoprefixer\node_modules\autoprefixer\lib\hacks\flex.js' Copying file: 'node_modules\grunt-autoprefixer\node_modules\autoprefixer\lib\hacks\fullscreen.js' Copying file: 'node_modules\grunt-autoprefixer\node_modules\autoprefixer\lib\hacks\gradient.js' Omitting next output lines... Processed 975 files... Error: The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters. Failed exitCode=1, command="kudusync" -v 50 -f "D:\home\site\repository" -t "D:\home\site\wwwroot" -n "D:\home\site\deployments\360cd39f800d7a19bf82bb41d4bd85830829a303\manifest" -p "D:\home\site\deployments\8ff648ca5da1071c0480e2ad3aa8a82eafeccb00\manifest" -i ".git;.hg;.deployment;deploy.cmd" An error has occurred during web site deployment. 

  • 安装yeoman时出错
  • 安装Yeoman时出错(npm install -g哟)
  • Yeoman.js是否configuration客户端和服务器的东西?
  • 如何在我的angular度js应用程序中正确设置checklist-model指令?
  • Yeoman返回'env:node \ r:没有这样的文件或目录'
  • 使用命令创build项目文件夹时获取错误yo cg-angular
  • 自定义消息在Yeoman结束时生成
  • .lock文件在试图生成Yeoman Chrome扩展时会受到阻碍
  • path错误是我遇到的Grunt工作。 似乎是一个Windows问题,并没有任何简单/很好的解决scheme。

    我们用Grunt工作完成的一件事是在Windows中大量使用符号链接。 http://technet.microsoft.com/en-us/library/cc753194.aspx

    例如,我们将所有Grunt依赖项安装在一个目录中,然后创build符号链接作为构build到该目录的一部分。 这可能有助于克服长目录/文件名问题。

    在第二个问题上还不是很清楚,但是如果文件存在于其他地方,mklink也可以帮助解决这个问题。