2017-04-20 59 views
0

我在前端有一個帶有angular2的asp.net核心應用程序。我用dotnet new angular創建了它。無法將我的Asp.Net Core + Angular發佈到azure

當我嘗試將其發佈到服務器上,它似乎無法上安裝的依賴:

npm install 
npm ERR! Windows_NT 10.0.14393 
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" 
npm ERR! node v6.10.2 
npm ERR! npm v3.10.10 
npm ERR! code ETARGET 

npm ERR! notarget No compatible version found: @types/[email protected] 
npm ERR! notarget Valid install targets: 
npm ERR! notarget 2.0.41, 2.0.40, 2.0.39, 2.0.38, 2.0.37, 2.0.36, 2.0.35, 2.0.34, 2.0.33, 2.0.32, 1.10.31, 1.10.30, 1.10.29, 1.10.28, 1.10.27, 1.10.26-alpha, 1.10.25-alpha, 1.10.24-alpha, 1.10.23-alpha, 1.10.22-alpha, 1.10.21-alpha, 1.10.20-alpha, 1.10.15-alpha, 1.10.14-alpha, 1.10.8-alpha 
npm ERR! notarget 
npm ERR! notarget This is most likely not a problem with npm itself. 
npm ERR! notarget In most cases you or one of your dependencies are requesting 
npm ERR! notarget a package version that doesn't exist. 
npm ERR! notarget 
npm ERR! notarget It was specified as a dependency of 'AstroWeb' 
npm ERR! notarget 

但它在當地的正常工作。

package.json

{ 
    "name": "AstroWeb", 
    "version": "0.0.0", 
    "scripts": { 
    "test": "karma start ClientApp/test/karma.conf.js" 
    }, 
    "dependencies": { 
    "@angular/common": "^2.4.5", 
    "@angular/compiler": "^2.4.5", 
    "@angular/core": "^2.4.5", 
    "@angular/forms": "^2.4.5", 
    "@angular/http": "^2.4.5", 
    "@angular/platform-browser": "^2.4.5", 
    "@angular/platform-browser-dynamic": "^2.4.5", 
    "@angular/platform-server": "^2.4.5", 
    "@angular/router": "^3.4.5", 
    "@types/node": "^6.0.42", 
    "@types/jquery": "2.2.1" , 
    "angular2-platform-node": "~2.0.11", 
    "angular2-template-loader": "^0.6.2", 
    "angular2-universal": "^2.1.0-rc.1", 
    "angular2-universal-patch": "^0.2.1", 
    "angular2-universal-polyfills": "^2.1.0-rc.1", 
    "aspnet-prerendering": "^2.0.0", 
    "aspnet-webpack": "^1.0.17", 
    "awesome-typescript-loader": "^3.0.0", 
    "bootstrap": "^3.3.7", 
    "css": "^2.2.1", 
    "css-loader": "^0.25.0", 
    "es6-shim": "^0.35.1", 
    "event-source-polyfill": "^0.0.7", 
    "expose-loader": "^0.7.1", 
    "extract-text-webpack-plugin": "^2.0.0-rc", 
    "file-loader": "^0.9.0", 
    "html-loader": "^0.4.4", 
    "isomorphic-fetch": "^2.2.1", 
    "jquery": "^2.2.1", 
    "json-loader": "^0.5.4", 
    "preboot": "^4.5.2", 
    "raw-loader": "^0.5.1", 
    "rxjs": "^5.0.1", 
    "style-loader": "^0.13.1", 
    "to-string-loader": "^1.1.5", 
    "typescript": "^2.2.1", 
    "url-loader": "^0.5.7", 
    "webpack": "^2.2.0", 
    "webpack-hot-middleware": "^2.12.2", 
    "webpack-merge": "^0.14.1", 
    "zone.js": "^0.7.6" 
    }, 
    "devDependencies": { 
    "@types/chai": "^3.4.34", 
    "@types/jasmine": "^2.5.37", 
    "chai": "^3.5.0", 
    "jasmine-core": "^2.5.2", 
    "karma": "^1.3.0", 
    "karma-chai": "^0.1.0", 
    "karma-chrome-launcher": "^2.0.0", 
    "karma-cli": "^1.0.1", 
    "karma-jasmine": "^1.0.2", 
    "karma-webpack": "^1.8.0" 
    } 
} 

出了什麼問題?

編輯

我想提議阿德里安廳指定節點的版本,但它並沒有解決這個問題:

npm install 
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected]^1.0.0 (node_modules\chokidar\node_modules\fsevents): 
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}) 
npm ERR! Windows_NT 10.0.14393 
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" 
npm ERR! node v6.10.2 
npm ERR! npm v3.10.10 
npm ERR! code ETARGET 

npm ERR! notarget No compatible version found: @types/[email protected] 
npm ERR! notarget Valid install targets: 
npm ERR! notarget 2.0.41, 2.0.40, 2.0.39, 2.0.38, 2.0.37, 2.0.36, 2.0.35, 2.0.34, 2.0.33, 2.0.32, 1.10.31, 1.10.30, 1.10.29, 1.10.28, 1.10.27, 1.10.26-alpha, 1.10.25-alpha, 1.10.24-alpha, 1.10.23-alpha, 1.10.22-alpha, 1.10.21-alpha, 1.10.20-alpha, 1.10.15-alpha, 1.10.14-alpha, 1.10.8-alpha 
npm ERR! notarget 
npm ERR! notarget This is most likely not a problem with npm itself. 
npm ERR! notarget In most cases you or one of your dependencies are requesting 
npm ERR! notarget a package version that doesn't exist. 
npm ERR! notarget 
npm ERR! notarget It was specified as a dependency of 'AstroWeb' 
npm ERR! notarget 

我試圖設置版本2.0.41在packages.json中,我不再有同樣的問題,只是我現在失敗的import 'jquery'中的一個。

我也設法(上https://my-site.scm.azurewebsites.net/DebugConsolenpm install -g npm這似乎升級遠程NPM版本(在4.5.0),這似乎現在已經解決了這個問題

回答

0

你的node.js版本上運行(可能npm版本)可能與Azure App Service上使用的默認版本不同。使用package.json的「引擎」部分在節點和npm上指定正確的版本。看到我的博客文章,提到這一點:https://shellmonger.com/2015/08/29/continuous-deployment-nodejs-and-microsoft-azure/

+0

應該指定哪個引擎版本? – J4N

+0

我試圖指定與我的相同(> = 3.10.10),但我仍然遇到同樣的問題。但NPM抱怨jquery,不是? – J4N

+0

另外,我的版本是剛剛發佈的發佈腳本中顯示的版本,所以您的意思是我應該將本地版本與遠程使用的版本配合使用。因爲我嘗試將npm + node版本設置爲我在本地或遠程所使用的版本,並且我遇到同樣的問題 – J4N

0

請檢查這篇文章 - Angular 2 web app in Azure returning system is not defined error有關節點版本添加到您的應用程序。

+0

你指的是什麼帖子?我檢查了你的問題,但我沒有找到任何東西。另外,這不是jQuery的問題? – J4N

+0

http://stackoverflow.com/questions/42982340/angular-2-web-app-in-azure-returning-system-is-not-defined-error?noredirect=1#comment73136039_42982340。你可以檢查這個並添加節點版本 – Born2Code

+0

嗨J4N,它解決了你的問題? – Born2Code

相關問題