简体   繁体   English

npm安装 <package> 工作和NPM安装不工作

[英]npm install <package> working and npm install not working

If I download the source code and run: 如果我下载源代码并运行:

npm install

It crashes during installation ( I think it runs out of memory), however if I directly: 它在安装过程中崩溃(我认为它用完了内存),但是如果我直接这样做:

npm install bigchaindb-driver

(version 0.3.0) Then is fine... (版本0.3.0)然后就可以了...

Log error: 记录错误:

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

Btw if I install them one by one, it does not run out of memory but it is not able to install the following dependencies: 顺便说一句,如果我一个接一个地安装它们,它不会耗尽内存,但无法安装以下依赖项:

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.

Why with one method is working and with the other no? 为什么用一种方法行得通而用另一种方法不行? what is the difference between the commands and how could I fix it? 命令之间有什么区别,我该如何解决?

Edit: Ubuntu 16.04 64bit 编辑: Ubuntu 16.04 64位

npm 3.10.10 npm 3.10.10

nodejs 6.11.4 的NodeJS 6.11.4

bigchaindb-driver 0.3.0 bigchaindb驱动程序0.3.0

Package.json: Package.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"
    }

The package.json is the original from js-bigchaindb-driver package.json是来自js-bigchaindb-driver的原始文件

Finally, I found the source of the error: 最后,我找到了错误的根源:

npm install  

Installs the package with the development dependencies and it is needed to add the flag --production not to get them. 安装具有开发依赖项的软件包,需要添加标志--production来获取它们。

So the equivalent will be: 因此,等效项为:

npm install <package>

and

npm install --production  

(assuming there is a package.json in the directory) (假设目录中有一个package.json)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM