Node.js npm不';I don’我没有按预期工作

Node.js npm不';I don’我没有按预期工作,node.js,npm,npm-install,Node.js,Npm,Npm Install,运行npm install从任何包含package.json的目录目前对我不起作用。我甚至在一些著名的项目中尝试过,但问题是相同的,所以我想这不是我弄乱了我的包.json 所以问题是,npm install实际上在我的本地node\u modules目录中安装了大约241个modules。而我在package.json中只清楚地列出了3个。每次我运行npm时,它都会一次又一次地突然安装 我以前使用的代码与git相同,npm安装只在我的node\u模块中生成了3个包 $ npm -v 3.8.1

运行
npm install
任何包含
package.json
目录目前对我不起作用。我甚至在一些著名的项目中尝试过,但问题是相同的,所以我想这不是我弄乱了我的
包.json

所以问题是,
npm install
实际上在我的本地
node\u modules
目录中安装了大约241个modules。而我在
package.json
中只清楚地列出了3个。每次我运行npm时,它都会一次又一次地突然安装

我以前使用的代码与git相同,
npm安装
只在我的
node\u模块中生成了3个包

$ npm -v
3.8.1

$ node -v
v5.8.0
node\u模块内的模块列表

$ ls node_modules/
ansi-regex        color-convert           extract-zip               gulp-concat        isstream                lodash.template          ordered-read-streams  request                supports-color
ansi-styles       combined-stream         extsprintf                gulp-util          jodid25519              lodash.templatesettings  os-homedir            resolve                throttleit
archy             commander               fancy-log                 gulplog            jsbn                    loud-rejection           parse-json            rimraf                 through2
array-differ      concat-map              fd-slicer                 har-validator      json-schema             lru-cache                path-exists           semver                 tildify
array-find-index  concat-stream           find-index                has-ansi           json-stringify-safe     map-obj                  path-is-absolute      sequencify             time-stamp
array-uniq        concat-with-sourcemaps  find-up                   has-gulplog        jsonpointer             meow                     path-type             sigmund                tough-cookie
asn1              core-util-is            findup-sync               hawk               jsprim                  mime-db                  pend                  signal-exit            trim-newlines
assert-plus       cryptiles               first-chunk-stream        hoek               liftoff                 mime-types               pify                  single-line-log        tunnel-agent
async             dashdash                flagged-respawn           home-path          load-json-file          minimatch                pinkie                sntp                   tweetnacl
aws-sign2         dateformat              forever-agent             hosted-git-info    lodash                  minimist                 pinkie-promise        source-map             typedarray
aws4              debug                   form-data                 http-signature     lodash._basecopy        mkdirp                   pretty-bytes          sparkles               unique-stream
balanced-match    decamelize              gaze                      indent-string      lodash._basetostring    ms                       pretty-hrtime         spdx-correct           user-home
beeper            deep-extend             generate-function         inflight           lodash._basevalues      multipipe                process-nextick-args  spdx-exceptions        util-deprecate
bl                defaults                generate-object-property  inherits           lodash._getnative       mv                       progress-stream       spdx-expression-parse  v8flags
boom              delayed-stream          get-stdin                 ini                lodash._isiterateecall  ncp                      pseudomap             spdx-license-ids       validate-npm-package-license
bower             deprecated              glob                      interpret          lodash._reescape        node-uuid                qs                    speedometer            verror
brace-expansion   duplexer2               glob-stream               is-arrayish        lodash._reevaluate      normalize-package-data   rc                    sshpk                  vinyl
builtin-modules   ecc-jsbn                glob-watcher              is-builtin-module  lodash._reinterpolate   nugget                   read-pkg              stream-consume         vinyl-fs
camelcase         electron-download       glob2base                 is-finite          lodash._root            number-is-nan            read-pkg-up           string_decoder         wrappy
camelcase-keys    electron-prebuilt       globule                   is-my-json-valid   lodash.escape           oauth-sign               readable-stream       stringstream           xtend
caseless          end-of-stream           glogg                     is-property        lodash.isarguments      object-assign            rechoir               strip-ansi             yallist
chalk             error-ex                graceful-fs               is-typedarray      lodash.isarray          object-keys              redent                strip-bom              yauzl
clone             escape-string-regexp    graceful-readlink         is-utf8            lodash.keys             once                     repeating             strip-indent
clone-stats       extend                  gulp                      isarray            lodash.restparam        orchestrator             replace-ext           strip-json-comments
package.json

{
  "name": "test",
  "version": "1.0.0",
  "main": "main.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "./node_modules/electron-prebuilt/dist/electron --harmony --enable-transparent-visuals ."
  },
  "author": "ishankhare07@gmail.com",
  "license": "MIT",
  "dependencies": {
    "bower": "^1.7.7",
    "electron-prebuilt": "^0.36.7",
    "gulp": "^3.9.1",
    "gulp-concat": "^2.6.0"
  },
  "devDependencies": {},
  "description": ""
}

npm的这种行为已从版本2更改为版本3及更高版本:版本2及更高版本使用了子文件夹。从版本3开始,您得到了一个扁平的包结构。因此,您现在看到的是以前作为4个依赖项的子文件夹(node_模块)提供的所有临时依赖项

然而,最终的行为应该完全相同


可以找到这背后的基本原理。

npm的这种行为已从版本2更改为版本3及更高版本:版本2及更旧的子文件夹。从版本3开始,您得到了一个扁平的包结构。因此,您现在看到的是以前作为4个依赖项的子文件夹(node_模块)提供的所有临时依赖项

然而,最终的行为应该完全相同


可以找到这背后的基本原理。

我们已经这样做了,但是我觉得这与此文件没有任何关系。这些文件已提交到git,并且有一段时间没有更改
npm
现在感觉像是满是狗屎,因为网络上的许多其他人都遇到了各种各样的问题。我已经这样做了,但是我觉得它与这个文件没有任何关系。这些文件已提交到git,并且有一段时间没有更改
npm
现在感觉像是满满的狗屎,因为网络上的许多其他人都遇到了各种各样的问题。你能详细介绍一下
扁平包吗?为什么下载一堆垃圾软件包是合理的,而它应该做的只是安装3?正如我在回答中希望解释的那样:在过去,你得到的是相同的s**t软件包,只有隐藏在你的3个主要软件包的子文件夹中:)如果我理解正确,这与软件的组织有什么关系吗(内部/递归)依赖项,(依赖项的依赖项)在
node\u modules
的根目录中,而不是将其组织为一棵树?你能详细说明一下
flat package
吗?为什么下载大量的软件包是合理的,而它所要做的就是安装3?正如我在回答中希望解释的那样:在过去,你得到的软件包的s**t负载是相同的,只有那些被隐藏在3个主要包的子文件夹:)如果我理解正确,它是否与(内部/递归)依赖项的组织有关,(依赖项的依赖项)以
节点\ u模块的根的形式组织,而不是将其组织为树?