私はこのようなpackage.jsonファイルを持っています。npm installはpackage.jsにないモジュールをロードします
{
"name": "package",
"version": "1.0.0",
"description": "wordpress",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"devDependencies": {
"grunt": "^0.4.5",
"grunt-cli": "^0.1.13",
"grunt-contrib-cssmin": "^0.9.0",
"load-grunt-tasks": "^0.4.0",
"grunt-bower-install": "~0.7.0",
"grunt-contrib-sass": "^0.7.3",
"grunt-contrib-jshint": "^0.10.0",
"grunt-contrib-uglify": "^0.4.0",
"grunt-contrib-watch": "^0.6.1",
"grunt-contrib-concat": "^0.4.0",
"grunt-concat-css": "^0.3.1",
"matchdep": "^0.3.0",
"grunt-bower-install": "^1.6.0",
"grunt-modernizr": "^0.5.2",
"grunt-notify": "~0.2.3"
}
}
私は
npm install
を実行すると、それはnode_modulesフォルダを作成するには、package.jsonファイルにモジュールを追加するだけでなく、私が参照されていません他のモジュールの多くを追加します。
最近ノードバージョンをアップグレードしたか、npmを2.xから3.xにアップグレードした場合、最新バージョンが 'node_modules'の下のディレクトリ構造を"平坦化 "していることがわかります。 2.xのようにモジュールをモジュールに入れ子にするのではなく、すべてのモジュールが 'node_modules'のルートにインストールされます。これは、パスの長さのようないくつかの点で役立ちます。これは、Windowsシステムで問題になる可能性があります。私の推測では、これはあなたが見ているものですが、変更がv3.xで導入されたことはわかりませんでした。 –