2016-06-15 12 views
6

Ich versuche, mein Projekt mithilfe von Azures Git-Bereitstellung zu erstellen und zu packen.Grunt-Installation schlägt bei Bereitstellung von azure Web-App durch deploy.cmd-Datei fehl

Ich habe die folgenden Dateien erstellt

  1. .deployment
  2. deploy.cmd
  3. Gruntfile.js
  4. package.json
  5. bower.json

I‘ Ich folgte der blog post von Jay Harris. Unten der Entfaltungsabschnitt in deploy.cmd Datei ist:

:: 2. Select node version 
call :SelectNodeVersion 

:: 3. Install npm packages 
IF EXIST "%DEPLOYMENT_TARGET%\package.json" (
    pushd "%DEPLOYMENT_TARGET%" 
    call :ExecuteCmd !NPM_CMD! install --production 
    IF !ERRORLEVEL! NEQ 0 goto error 
    popd 
) 

:: 4. Install bower packages 
IF EXIST "%DEPLOYMENT_TARGET%\bower.json" (
    call !NPM_CMD! install bower 
    IF !ERRORLEVEL! NEQ 0 goto error 
    call .\node_modules\.bin\bower install 
    IF !ERRORLEVEL! NEQ 0 goto error 
) 

:: 4. run grunt 
IF EXIST "%DEPLOYMENT_TARGET%\Gruntfile.js" ( 
    call !NPM_CMD! install grunt-cli 
    call .\node_modules\.bin\grunt --no-color clean common dist 
    IF !ERRORLEVEL! NEQ 0 goto error 
) 

Deployment nicht mit folgenden Fehlern:

Selected npm version 3.8.6 
Updating iisnode.yml at D:\home\site\wwwroot\iisnode.yml 
[email protected] D:\home\site\wwwroot 
+-- [email protected] extraneous 
npm WARN [email protected] requires a peer of [email protected]>=0.4.0 but none was installed. 
+-- UNMET PEER DEPENDENCY [email protected]>=0.4.0 
`-- [email protected] extraneous 

[email protected] D:\home\site\repository 
`-- [email protected] extraneous 

[email protected] D:\home\site\repository 
+-- [email protected] extraneous 
`-- [email protected] extraneous 

grunt-cli: The grunt command line interface (v1.2.0) 

Fatal error: Unable to find local grunt. 

If you're seeing this message, grunt hasn't been installed locally to 
your project. For more information about installing and configuring grunt, 
please see the Getting Started guide: 

http://gruntjs.com/getting-started 
An error has occurred during web site deployment. 
npm WARN [email protected] requires a peer of [email protected]>=0.4.0 but none was installed.\r\nC:\Program Files (x86)\SiteExtensions\Kudu\55.50610.2267\bin\Scripts\starter.cmd deploy.cmd 

Ich bin nicht sicher, was sonst muß ich hier tun, um es installiert werden. Versucht, über das Internet nach ähnlichen Problemen zu suchen, konnte aber keine konkreten Lösungen für das Problem finden. Es wäre toll, wenn mir jemand dabei helfen könnte.

Mein package.json

{ 
    "name": "myapp", 
    "private": true, 
    "devDependencies": { 
    "autoprefixer-core": "^5.2.1", 
    "grunt": "^0.4.5", 
    "grunt-angular-templates": "^0.5.7", 
    "grunt-concurrent": "^1.0.0", 
    "grunt-contrib-clean": "^0.6.0", 
    "grunt-contrib-compass": "^1.0.0", 
    "grunt-contrib-concat": "^0.5.0", 
    "grunt-contrib-connect": "^0.9.0", 
    "grunt-contrib-copy": "^0.7.0", 
    "grunt-contrib-cssmin": "^0.12.0", 
    "grunt-contrib-htmlmin": "^0.4.0", 
    "grunt-contrib-imagemin": "^1.0.0", 
    "grunt-contrib-jshint": "^0.11.0", 
    "grunt-contrib-uglify": "^0.7.0", 
    "grunt-contrib-watch": "^0.6.1", 
    "grunt-filerev": "^2.1.2", 
    "grunt-google-cdn": "^0.4.3", 
    "grunt-jscs": "^1.8.0", 
    "grunt-newer": "^1.1.0", 
    "grunt-ng-annotate": "^0.9.2", 
    "grunt-postcss": "^0.5.5", 
    "grunt-svgmin": "^2.0.0", 
    "grunt-usemin": "^3.0.0", 
    "grunt-wiredep": "^2.0.0", 
    "imagemin": "^5.2.1", 
    "jasmine-core": "^2.4.1", 
    "jit-grunt": "^0.9.1", 
    "jshint-stylish": "^1.0.0", 
    "karma": "^0.13.22", 
    "karma-jasmine": "^1.0.2", 
    "karma-phantomjs-launcher": "^1.0.0", 
    "phantomjs-prebuilt": "^2.1.7", 
    "readable-stream": "^2.1.4", 
    "through2": "^2.0.1", 
    "time-grunt": "^1.0.0", 
    "vinyl-fs": "^2.2.1" 
    }, 
    "engines": { 
    "node": ">=0.10.0" 
    }, 
    "scripts": { 
    "test": "karma start test\\karma.conf.js" 
    } 
} 

HINWEIS: Bisher keine Lösung gefunden, ich werde Azure Support-Team um herauszufinden, was ich tun kann. Ich werde die Frage aktualisieren, sobald ich eine Lösung gefunden habe.

Antwort

2

meisten similarquestions (nicht für azur though) verweisen auf:

npm install grunt --save-dev 
npm install -g grunt --save-dev 

(versuchen, die globale -g installieren, wenn Sie grunt aus einem Skript zu verwenden sind)

This thread erwähnt Grunzen installiert werden soll und vorhanden in der PATH für azurblau:

The problem is not that grunt is not found on the path (" D:\Program Files (x86)\grunt\0.1.13\grunt "). It definitely starts running, but it's grunt itself that complains.
If I got to Kudu console and run ' grunt ' from the D:\home\site\repository folder, it displays exactly the same thing.

projectkudu/kudu Issue 1150 bestätigt:

this does not happen when running Kudu locally (i.e. outside of Azure).
So maybe something funky with the runtime env on Azure Websites.

Wie in grunt issue 1459 gesehen, überprüfen Sie den Fehlercode Exit-Status:

$ echo $? 
99 

we will first rename the node_modules/grunt directory, so that grunt-cli will be unable to find local grunt. This should result in error code 99.

The expected results occur, which make me believe the misleading grunt-cli error message has confused developers into thinking that Grunt itself is returning the wrong error code.

So im Fall von Azure, grunzt installiert und auf dem Weg sein könnte, aber nicht wo grunt-cli es erwartet.

+0

Sie sagen also, dass es dafür keine Lösung gibt? – JPReddy

+0

@JPReddy Ich sage, dass, wenn, nachdem Sie getestet haben, dass 'grunt' tatsächlich korrekt installiert ist (lokal oder global mit' -g') und das Problem bestehen bleibt, müssen Sie überprüfen, wo 'grunt-cli'' grunt erwartet ', und wenn sich dies als schwer fassbar erweist, eskalieren Sie den Fall mit Azure und prüfen Sie, ob das Problem mit der Umgebung zusammenhängt. – VonC

+0

Sie haben Recht, ich denke, ich muss es an Azure-Support-Team Eskalieren – JPReddy

2

Kontrollieren Sie, dass Ihre package.json folgende Zeile hat.

"devDependencies": { 
    "grunt": "~0.4.5", 
.. 
} 

Grunt-CLI erwartet lokalen Grunt in Ihrem Projekt. Dieser Fehler

ist über diesen lokalen Grunt.Da Ihr Skript bereits ausgeführt npm installieren, alles, was Sie tun müssen, fügen Sie das "grunt": "~ 0.4.5" Zeile zu Ihrem Paket.json in Abhängigkeiten.

Folgende Befehl auch dasselbe tun, das Hinzufügen von grunt zu devDependencies.

npm install grunt --save-dev 
+0

Es hat nicht funktioniert, Mate, habe ich bereits diese Abhängigkeiten Zeile in package.json – JPReddy

+0

Was ist diesmal Fehler? –

+0

Gleicher Fehler. Ich meine, Abhängigkeitseintrag ist da, noch bevor dieser Fehler auftauchte – JPReddy