npm install just do nothing on Kudu

2019-08-26 07:36发布

问题:

This morning I run npm install and the node_modules was created with all the files in it.

Then a few hour after, I run the same command same package.json file... no error, node_modules was created, but empty!?

ANy ideas?

Here my package.json, very regular generated via an npm init adding tedious package.

{
  "name": "tedious",
  "version": "2.1.1",
  "description": "COnnect to Database",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/tediousjs/tedious.git"
  },
  "author": "",
  "license": "ISC",
  "bugs": {
    "url": "https://github.com/tediousjs/tedious/issues"
  },
  "homepage": "https://github.com/tediousjs/tedious#readme"
}

回答1:

There is no dependencies in your package.json.

You'll need to add the npm modules you want to install into the dependencies section of your package.json, and then run npm install to download them.

"dependencies": {
    "tedious": "^2.1.1",
    "express": "^4.14.0",
    ...................
}

Alternatively, you can use the command npm install <package_name> --save to do that.

Reference: Using a package.json.