sTrenat
sTrenat

Reputation: 1049

NPM Invalid Package during deployment found @types

I'm trying to run my first application with azure's continuous development, this is app from standard template from Visual Studio 2017 MVC net core 2.0, using React. I just pushed this app to my github, on branch configured with azure to auto deploy, and deploy log i can see this:

Command: "D:\home\site\deployments\tools\deploy.cmd"
Handling ASP.NET Core Web Application deployment.
  Restore completed in 680.87 ms for D:\home\site\repository\PortfolioKJ\PortfolioKJ.csproj.
  Restore completed in 1.08 sec for D:\home\site\repository\PortfolioKJ\PortfolioKJ.csproj.
Microsoft (R) Build Engine version 15.3.409.57025 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  PortfolioKJ -> D:\home\site\repository\PortfolioKJ\bin\Release\netcoreapp2.0\PortfolioKJ.dll
EXEC : npm ERR! error : Invalid Package: expected types/react-hot-loader but found @types/react-hot-loader [D:\home\site\repository\PortfolioKJ\PortfolioKJ.csproj]
  npm ERR!     at D:\Program Files (x86)\npm\1.4.28\node_modules\npm\lib\cache\add-local-tarball.js:161:14
  npm ERR!     at process._tickCallback (node.js:448:13)
  npm ERR! If you need help, you may report this *entire* log,
  npm ERR! including the npm and node versions, at:
  npm ERR!     <http://github.com/npm/npm/issues>

  npm ERR! System Windows_NT 6.2.9200
  npm ERR! command "node" "D:\\Program Files (x86)\\npm\\1.4.28\\node_modules\\npm\\bin\\npm-cli.js" "install"
  npm ERR! cwd D:\home\site\repository\PortfolioKJ
  npm ERR! node -v v0.10.40
  npm ERR! npm -v 1.4.28
  npm
D:\home\site\repository\PortfolioKJ\PortfolioKJ.csproj(39,5): error MSB3073: The command "npm install" exited with code 1.
Failed exitCode=1, command=dotnet publish "D:\home\site\repository\PortfolioKJ\PortfolioKJ.csproj" --output "D:\local\Temp\8d52bb32bb3bc7e" --configuration Release
An error has occurred during web site deployment.
\r\nD:\Program Files (x86)\SiteExtensions\Kudu\67.61109.3117\bin\Scripts\starter.cmd "D:\home\site\deployments\tools\deploy.cmd"

I realy don't know what i can do now. I was hoping that if everything is standard, it could run without issues.

Here is tsconfig.json

{
  "compilerOptions": {
    "baseUrl": ".",
    "module": "es2015",
    "moduleResolution": "node",
    "target": "es5",
    "jsx": "react",
    "experimentalDecorators": true,
    "sourceMap": true,
    "skipDefaultLibCheck": true,
    "strict": true,
    "lib": ["es6", "dom"],
    "types": ["webpack-env"]
  },
  "exclude": [
      "bin",
      "node_modules"
  ]
}

On my local PC everything works great.

Upvotes: 0

Views: 651

Answers (2)

sTrenat
sTrenat

Reputation: 1049

Missed line

I found my issue. Problem was with line npm ERR! node -v v0.10.40, default version of node, on azure server was 0.10, which couldn't resolve what @types mean. To solve this, I had to add line WEBSITE_NODE_DEFAULT_VERSION, and value 4.2.3, to my Application's settings on Azure.

Upvotes: 2

basarat
basarat

Reputation: 276125

Focus in on the error message:

Invalid Package: expected types/react-hot-loader but found @types/react-hot-loader

This will happen if you have types/react-hot-loader was mentioned in some package.json.

Fix

Make sure all references to types are prefixed with @ i.e. @types. Obvious place to check is package.json for simple JavaScript / TypeScript projects

More

Since you are using ASP.Net build tooling you might need to fiddle with msbuild / proj files. If not, there might be a bug in the template or azure auto deploy code.

Upvotes: 0

Related Questions