0

如果我下载源代码并运行:

npm install

它在安装过程中崩溃(我认为它内存不足),但是如果我直接:

npm install bigchaindb-driver

(0.3.0版)那就好了……

日志错误:

npm http request GET https://registry.npmjs.org/is-fullwidth-code-point
npm http 304 https://registry.npmjs.org/is-fullwidth-code-point
npm info attempt registry request try #1 at 8:08:57 PM
npm http request GET https://registry.npmjs.org/lcid
npm info attempt registry request try #1 at 8:08:57 PM
npm http request GET https://registry.npmjs.org/mem
npm http 304 https://registry.npmjs.org/lcid
npm http 304 https://registry.npmjs.org/mem
npm info attempt registry request try #1 at 8:08:57 PM
npm http request GET https://registry.npmjs.org/invert-kv
npm http 304 https://registry.npmjs.org/invert-kv
npm info lifecycle bigchaindb-driver@0.3.0~preinstall: bigchaindb-driver@0.3.0

Killed         ....] - extract:moo-server: sill gunzTarPerm extractEntry lolex.js

顺便说一句,如果我一一安装它们,它不会耗尽内存,但它无法安装以下依赖项:

bigchaindb-driver@0.3.0 /
+-- UNMET PEER DEPENDENCY babel-eslint@8.0.0
+-- UNMET PEER DEPENDENCY eslint@4.1.1
`-- UNMET PEER DEPENDENCY webpack@3.0.0

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN babel-loader@7.0.0 requires a peer of webpack@2 but none was installed.
npm WARN eslint-config-airbnb-base@11.3.2 requires a peer of eslint@^3.19.0 || ^4.5.0 but none was installed.
npm WARN eslint-config-airbnb-base@11.3.2 requires a peer of eslint-plugin-import@^2.7.0 but none was installed.
npm WARN eslint-config-ascribe@3.0.4 requires a peer of babel-eslint@^7.1.1 but none was installed.
npm WARN eslint-plugin-import@2.2.0 requires a peer of eslint@2.x - 3.x but none was installed.

为什么一种方法有效而另一种无效?命令之间有什么区别,我该如何解决?

编辑: Ubuntu 16.04 64bit

npm 3.10.10

节点 6.11.4

bigchaindb-驱动程序 0.3.0

包.json:

{
  "_args": [
    [
      {
        "raw": "bigchaindb-driver",
        "scope": null,
        "escapedName": "bigchaindb-driver",
        "name": "bigchaindb-driver",
        "rawSpec": "",
        "spec": "latest",
        "type": "tag"
      },
      "/test_bcdb"
    ]
  ],
  "_from": "bigchaindb-driver@latest",
  "_id": "bigchaindb-driver@0.3.0",
  "_inCache": true,
  "_location": "/bigchaindb-driver",
  "_nodeVersion": "7.8.0",
  "_npmOperationalInternal": {
    "host": "s3://npm-registry-packages",
    "tmp": "tmp/bigchaindb-driver-0.3.0.tgz_1499272002696_0.40300624282099307"
  },
  "_npmUser": {
    "name": "vrde",
    "email": "agranzot@gmail.com"
  },
  "_npmVersion": "5.0.4",
  "_phantomChildren": {},
  "_requested": {
    "raw": "bigchaindb-driver",
    "scope": null,
   "escapedName": "bigchaindb-driver",
    "name": "bigchaindb-driver",
    "rawSpec": "",
    "spec": "latest",
    "type": "tag"
  },
  "_requiredBy": [
    "#USER"
  ],
  "_resolved": "https://registry.npmjs.org/bigchaindb-driver/-/bigchaindb-driver-0.3.0.tgz",
  "_shasum": "2c71ab0e49dd7cbd6f760639767d4148e911e92b",
  "_shrinkwrap": null,
  "_spec": "bigchaindb-driver",
  "_where": "/test_bcdb",
  "author": {
    "name": "BigchainDB"
  },
  "ava": {
    "files": [
      "test/*.js"
    ],
    "source": [
      "**/*.{js,jsx}",
      "!node_modules/**/*",
      "!dist/**/*"
    ],
    "failFast": true,
    "failWithoutAssertions": false,
    "tap": true,
    "powerAssert": false,
    "require": [
      "babel-register"
        ],
        "babel": "inherit"
      },
      "browser": "./dist/browser/bigchaindb-driver.cjs2.min.js",
      "bugs": {
        "url": "https://github.com/bigchaindb/js-bigchaindb-driver/issues"
      },
      "dependencies": {
        "browser-resolve": "^1.11.2",
        "bs58": "^4.0.0",
        "buffer": "^5.0.2",
        "clone": "^2.1.0",
        "core-js": "^2.4.1",
        "decamelize": "^1.2.0",
        "es6-promise": "^4.0.5",
        "fetch-ponyfill": "^4.0.0",
        "five-bells-condition": "^5.0.1",
        "isomorphic-fetch": "^2.2.1",
        "js-sha3": "^0.6.1",
        "js-utility-belt": "^1.5.0",
        "json-stable-stringify": "^1.0.1",
        "query-string": "^4.3.4",
        "sprintf-js": "^1.0.3",
        "tweetnacl": "^1.0.0",
        "yarn": "^0.27.5"
      },
      "description": "Node.js driver for BigchainDB",
      "devDependencies": {
        "ava": "^0.20.0",
        "babel-cli": "^6.22.2",
        "babel-eslint": "^7.1.1",
        "babel-loader": "^7.0.0",
        "babel-plugin-add-module-exports": "^0.2.1",
        "babel-plugin-transform-es2015-modules-commonjs": "^6.23.0",
        "babel-plugin-transform-export-extensions": "^6.22.0",
        "babel-plugin-transform-object-assign": "^6.22.0",
        "babel-plugin-transform-object-rest-spread": "^6.23.0",
        "babel-plugin-transform-runtime": "^6.23.0",
        "babel-preset-es2015-no-commonjs": "0.0.2",
        "babel-preset-latest": "^6.22.0",
        "babel-runtime": "^6.22.0",
        "cross-env": "^5.0.1",
        "eslint": "^4.1.1",
        "eslint-config-ascribe": "^3.0.4",
        "eslint-plugin-import": "^2.2.0",
        "husky": "^0.14.0",
        "lint-staged": "^4.0.0",
        "nyc": "^11.0.2",
        "release-it": "^2.7.3",
        "rimraf": "^2.5.4",
        "sinon": "^2.3.4",
        "webpack": "^3.0.0"
      },
      "directories": {},
      "dist": {
        "integrity": "sha512-zpy0xZ73PXfH2k5sNTukgd7drPvGrHcPdA520glBGRiv3pfENo3TBFtNfGBymGRVRfQ519GFR+vzCbmftCs24w==",
        "shasum": "2c71ab0e49dd7cbd6f760639767d4148e911e92b",
        "tarball": "https://registry.npmjs.org/bigchaindb-driver/-/bigchaindb-driver-0.3.0.tgz"
      },
      "gitHead": "a9fb0730727a7aca3d0f61662ad043dfca3b284f",
      "homepage": "https://www.bigchaindb.com/",
      "keywords": [
        "bigchaindb",
        "driver",
        "blockchain",
        "decentralized",
        "dapp"
      ],    
      "license": "Apache-2.0",
      "lint-staged": {
        "*.js": [
          "eslint"
        ] 
      },
      "main": "./dist/node/index.js",
      "maintainers": [
        {
          "name": "vrde",
          "email": "agranzot@gmail.com"
        }
      ],
      "name": "bigchaindb-driver",
      "optionalDependencies": {},
      "readme": "ERROR: No README data found!",
      "repository": {
        "type": "git",
        "url": "git+https://github.com/bigchaindb/js-bigchaindb-driver.git"
      },
      "scripts": {
        "build": "npm run clean && npm run build:cjs && npm run build:dist",
        "build:bundle": "webpack",
        "build:cjs": "cross-env BABEL_ENV=cjs babel ./src -d dist/node",
        "build:dist": "cross-env NODE_ENV=production webpack -p",
        "clean": "rimraf dist/bundle dist/node",
        "lint": "eslint ./",
        "precommit": "lint-staged",
        "prepublishOnly": "npm update && npm run build",
        "release": "./node_modules/release-it/bin/release.js --src.tagName='v%s' --github.release --npm.publish --non-interactive",
        "release-major": "./node_modules/release-it/bin/release.js major --src.tagName='v%s' --github.release --npm.publish --non-interactive",
        "release-minor": "./node_modules/release-it/bin/release.js minor --src.tagName='v%s' --github.release --npm.publish --non-interactive",
        "report-coverage": "nyc report --reporter=lcov > coverage.lcov && codecov",
        "test": "npm run lint && nyc ava test/ && npm run thanks && npm run report-coverage",
        "thanks": "cowsay Hi, thanks for your interest in BigchainDB. We appreciate your contribution!"
      },
      "version": "0.3.0"
    }

package.json 是来自 js-bigchaindb-driver 的原始文件

4

1 回答 1

0

最后,我找到了错误的来源:

npm install  

安装具有开发依赖项的软件包,需要添加标志 --production 才能获取它们。

所以等价的将是:

npm install <package>

npm install --production  

(假设目录中有package.json)

于 2017-10-13T18:13:24.603 回答