0

I've an asp.net core app with angular2 on front end. I created it with dotnet new angular.

When I try to publish it to the server, it seems to fail on installing dependencies:

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 

But it works fine in local.

My 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"
  }
}

What could be wrong?

EDIT

I tried to specify the version of node as proposed by Adrian Hall, but it doesn't solve the issue:

npm install
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^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 

I tried to set the version 2.0.41 in the packages.json, I don't have the same issue anymore, just one of my import 'jquery' that fails now.

I also managed to run(on https://my-site.scm.azurewebsites.net/DebugConsole) npm install -g npm which seems to upgrade the remote NPM version(to the 4.5.0) which seems for now to have solved the issue

1 Answer 1

0

Your node.js version (and likely npm version) is likely different than the default version used on Azure App Service. Use the "engines" section of the package.json to specify the right version on node and npm. See my blog post that mentions this: https://shellmonger.com/2015/08/29/continuous-deployment-nodejs-and-microsoft-azure/

Sign up to request clarification or add additional context in comments.

4 Comments

which engine version should I specify?
I tried to specify the same as mine(>=3.10.10) but I still got the same issue. But NPM is complaining about jquery, no?
Also, my version is the one that is displayed on the publish script I just posted, so you mean I should MY local version to the one used remotely? Because I try to set the npm+node version to the one I've locally OR to the one I've remotely, and I've the same issue
You mentioned upgrading the remote NPM to 4.5.0 solved the issue. That indicates that your local dev environment uses a node/npm package combo that is newer than the remote node/npm package combo. You set the remote node/npm package combo with "engines" in the package.json. If your local env works and the remote env does not, you should set this to match your local env.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.