gpt4 book ai didi

javascript - npm 将所有依赖项和子依赖项放在同一个文件夹中

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:12:49 25 4
gpt4 key购买 nike

我的项目中有一个包含大约 20 个依赖项的 package.json 文件。当我做的时候

npm install

它将所有依赖项和子依赖项放在最顶层的 node_modules 目录中。它包含数百个模块,而它应该只有我的 20 个。子依赖项应该在我的主要依赖项下的 node_module 目录中,但它创建了一个平面结构。

我在 Ubuntu 14.04 上使用 npm 3.5.4 和 Node 0.10.41

任何人都可以帮助我安装具有正确树结构的模块吗?

编辑-----添加我的 packages.json 文件:

    {
"name": "lms",
"version": "1.0.0",
"main": "app.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"license": "ISC",
"dependencies": {
"aliasify": "^1.8.0",
"angular": "^1.4.7",
"angular-animate": "^1.4.7",
"angular-aria": "^1.4.7",
"angular-material": "^0.11.4",
"angular-resource": "^1.4.7",
"angular-ui-router": "^0.2.15",
"angular-ui-sortable": "^0.13.4",
"backbone": "^1.2.3",
"bootstrap": "^3.3.5",
"browser-sync": "^2.9.12",
"browserify": "^12.0.1",
"browserify-ngannotate": "^1.0.1",
"del": "^2.1.0",
"eslint": "^1.8.0",
"eslint-config-defaults": "^7.1.1",
"font-awesome": "^4.5.0",
"gulp": "^3.9.0",
"gulp-clean": "^0.3.1",
"gulp-concat": "^2.6.0",
"gulp-connect": "^2.2.0",
"gulp-connect-php": "0.0.7",
"gulp-eslint": "^1.1.1",
"gulp-minify-css": "^1.2.1",
"gulp-ng-annotate": "^1.1.0",
"gulp-open": "^1.0.0",
"gulp-sass": "^2.1.0",
"gulp-uglify": "^1.4.2",
"jquery": "^2.1.4",
"jquery-ui": "^1.10.5",
"lodash": "^3.10.1",
"merge-stream": "^1.0.0",
"ng-backbone": "file:local_node_modules/ng-backbone",
"vinyl-buffer": "^1.0.0",
"vinyl-source-stream": "^1.1.0"
},
"browserify": {
"transform": [
"aliasify"
]
},
"aliasify": {
"aliases": {
"underscore": "lodash"
}
}
}

最佳答案

这是预期的行为。由于版本 3 npm 尝试删除重复的依赖项并尽可能使用平面树。

参见 https://docs.npmjs.com/how-npm-works/npm3

关于javascript - npm 将所有依赖项和子依赖项放在同一个文件夹中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34572863/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com