У меня есть package.json
файл с
"dependencies": {
"packageA": "^1.0.0",
и у этого package A
есть другая зависимость в его package.json
"dependencies": {
"packageA_B": "^1.0.0",
Тогда, если я запускаю npm install
на windows 10
, node v11.11.0
я получаю
/node_modules/packageA
/node_modules/packageA/node_modules/packageA_B
Затем, если я удаляю этот пакет и запускаю npm install packageA
, я получаю
/node_modules/packageA
/node_modules/packageA_B
Что я и хочу с самого начала. Почему происходит это несоответствие? Как заставить устанавливать все пакеты не вложенным способом?
package.json
{
"name": "first_package",
"private": true,
"description": "",
"main": "gatsby-config.js",
"version": "0.2.25",
"author": "",
"dependencies": {
"packageA": "git+https://blah.git#h5c8f72",
"gatsby": "2.1.4",
"gatsby-plugin-compile-es6-packages": "^1.0.6",
"gatsby-plugin-offline": "^2.0.24",
"gatsby-plugin-page-creator": "^2.0.10",
"gatsby-plugin-react-helmet": "^3.0.8",
"gatsby-plugin-sharp": "^2.0.25",
"gatsby-plugin-styled-components": "^3.0.6",
"gatsby-source-filesystem": "^2.0.23",
"gatsby-transformer-sharp": "^2.1.15",
"path": "0.12.7",
"react": "16.8.6",
"react-dom": "16.8.6",
"styled-components": "^4.1.3",
"styled-icons": "^7.4.2"
},
"devDependencies": {
"babel-eslint": "^10.0",
"eslint": "^5.16.0",
"eslint-config-prettier": "^4.1.0",
"eslint-config-standard": "^12.0.0",
"eslint-plugin-import": "^2.16.0",
"eslint-plugin-node": "^8.0.1",
"eslint-plugin-prettier": "^3.0.1",
"eslint-plugin-promise": "^4.1.1",
"eslint-plugin-react": "^7.12.4",
"eslint-plugin-standard": "^4.0.0",
"gulp": "^4.0.0",
"gulp-help": "^1.6.1",
"prettier": "^1.16.4"
},
"keywords": [
""
],
"license": "",
"scripts": {
"build": "gatsby build",
"develop": "gatsby develop",
"start": "npm run develop",
"serve": "gatsby serve",
"test": "echo \"Write tests! -> https://gatsby.app/unit-testing\""
},
"repository": {
"type": "git",
"url": "https://"
},
"bugs": {
"url": "https://"
}
}
Package A package.json
{
"name": "packageA",
"private": true,
"description": "",
"version": "0.2.25",
"main": "index.js",
"author": "",
"dependencies": {
"packageA_B": "0.2.25",
"styled-components": "4.2.0",
"styled-icons": "7.9.0",
"babel-plugin-styled-components": "1.10.0",
"gatsby-plugin-styled-components": "3.0.7",
"gatsby-plugin-page-creator": "2.0.12",
"gatsby-source-filesystem": "2.0.28",
"gatsby-plugin-compile-es6-packages": "1.1.0",
"path": "0.12.7",
"esm": "3.2.14",
"prop-types": "15.7.2",
"gatsby-plugin-gtag": "1.0.10",
"gatsby-plugin-manifest": "2.0.26",
"react-cookie-consent": "2.2.2"
},
"peerDependencies": {
"gatsby": "2.1.4",
"react": "16.8.6",
"react-dom": "16.8.6"
},
"devDependencies": {
"gatsby": "2.1.4",
"react": "16.8.6",
"react-dom": "16.8.6",
"babel-eslint": "^10.0",
"eslint": "^5.16.0",
"eslint-config-prettier": "^4.1.0",
"eslint-config-standard": "^12.0.0",
"eslint-plugin-import": "^2.16.0",
"eslint-plugin-node": "^8.0.1",
"eslint-plugin-prettier": "^3.0.1",
"eslint-plugin-promise": "^4.1.1",
"eslint-plugin-react": "^7.12.4",
"eslint-plugin-standard": "^4.0.0",
"gulp": "^4.0.0",
"gulp-help": "^1.6.1",
"prettier": "^1.16.4"
},
"keywords": [
""
],
"license": "",
"scripts": {
"build": "gatsby build",
"develop": "gatsby develop",
"start": "npm run develop",
"serve": "gatsby serve",
"test": "echo \"Write tests! -> https://gatsby.app/unit-testing\""
},
"repository": {
"type": "git",
"url": ""
},
"bugs": {
"url": ""
}
}
Package A_B package.json
{
"name": "packageA_B",
"version": "0.2.25",
"description": "",
"author": "",
"main": "index.js",
"license": "",
"private": false,
"dependencies": {
"styled-components": "4.2.0",
"styled-icons": "7.9.0",
"babel-plugin-styled-components": "1.10.0",
"gatsby-plugin-styled-components": "3.0.7",
"gatsby-plugin-page-creator": "2.0.12",
"gatsby-source-filesystem": "2.0.28",
"gatsby-plugin-compile-es6-packages": "1.1.0",
"path": "0.12.7",
"esm": "3.2.14",
"prop-types": "15.7.2",
"gatsby-mdx": "0.4.2",
"@mdx-js/mdx": "0.20.3",
"@mdx-js/tag": "0.20.3",
"gatsby-image": "2.0.31",
"gatsby-plugin-offline": "2.0.25",
"gatsby-plugin-react-helmet": "3.0.11",
"gatsby-plugin-sharp": "2.0.32",
"gatsby-transformer-sharp": "2.1.17",
"react-helmet": "5.2.0",
"react-share": "2.4.0"
},
"peerDependencies": {
"gatsby": "2.1.4",
"react": "16.8.6",
"react-dom": "16.8.6"
},
"devDependencies": {
"gatsby": "2.1.4",
"react": "16.8.6",
"react-dom": "16.8.6",
"babel-eslint": "^10.0",
"eslint": "^5.16.0",
"eslint-config-prettier": "^4.1.0",
"eslint-config-standard": "^12.0.0",
"eslint-plugin-import": "^2.16.0",
"eslint-plugin-node": "^8.0.1",
"eslint-plugin-prettier": "^3.0.1",
"eslint-plugin-promise": "^4.1.1",
"eslint-plugin-react": "^7.12.4",
"eslint-plugin-standard": "^4.0.0",
"gulp": "^4.0.0",
"gulp-help": "^1.6.1",
"prettier": "^1.16.4"
},
"keywords": [
""
],
"scripts": {
"build": "gatsby build",
"develop": "gatsby develop",
"start": "npm run develop",
"serve": "gatsby serve",
"test": "echo \"Write tests! -> https://gatsby.app/unit-testing\""
},
"repository": {
"type": "git",
"url": ""
},
"bugs": {
"url": ""
}
}