依赖关系的非确定性行为 - nodejs

时间:2018-01-08 10:41:04

标签: javascript node.js express npm yarnpkg

我会解决一个警告:当我运行yarn install时,所有依赖项都已安装但我收到此警告:

  

警告模式[“esprima-fb@~3001.0001.0000-dev-harmony-fb”]是   试图在同一目的地打开包装   “/Users/Me/Library/Caches/Yarn/v1/npm-esprima-fb-3001.1.0-dev-harmony-fb-b77d37abcd38ea0b77426bb8bc2922ce6b426411”   作为模式[“esprima-fb@~3001.1.0-dev-harmony-fb”]。这可能会导致   在非确定性行为中,跳过。

如果我删除了node_modules文件夹,并且我运行yarn install我没有收到警告,当我重新执行yarn install时,我再次收到它。 我想问题出在纱线锁文件中。

的package.json

{
  "name": "n1",
  "version": "1.0.0",
  "description": "none ",
  "author": "none",
  "main": "src/index.js",
  "private": false,
  "engines": {
    "node": ">=7.6",
    "yarn": "*"
  },
  "scripts": {
    "precommit": "yarn lint",
    "prestart": "yarn docs",
    "start": "cross-env NODE_ENV=production pm2 start ./src/index.js",
    "dev": "nodemon ./src/index.js",
    "lint": "eslint **/*.js --ignore-path .gitignore --ignore-pattern internals/scripts",
    "lint:fix": "yarn lint -- --fix",
    "lint:watch": "yarn lint -- --watch",
    "test": "cross-env NODE_ENV=test nyc --reporter=html --reporter=text mocha --timeout 20000 --recursive src/api/tests",
    "test:unit": "cross-env NODE_ENV=test mocha src/api/tests/unit",
    "test:integration": "cross-env NODE_ENV=test mocha --timeout 20000 src/api/tests/integration",
    "test:watch": "cross-env NODE_ENV=test mocha --watch src/api/tests/unit",
    "coverage": "nyc report --reporter=text-lcov | coveralls",
    "postcoverage": "opn coverage/lcov-report/index.html",
    "validate": "yarn lint && yarn test",
    "postpublish": "git push --tags",
    "docs": "apidoc -i src -o docs",
    "postdocs": "opn docs/index.html"
  },
  "dependencies": {
    "bcryptjs": "^2.4.3",
    "blubird": "^0.0.1-security",
    "bluebird": "^3.5.1",
    "body-parser": "^1.18.2",
    "chalk": "^2.3.0",
    "color": "^2.0.1",
    "compression": "^1.7.1",
    "cookie-parser": "^1.4.3",
    "cors": "^2.8.4",
    "cross-env": "^5.1.3",
    "dotenv-safe": "^4.0.4",
    "espree": "^3.5.2",
    "esprima": "^4.0.0",
    "express": "^4.16.2",
    "express-validation": "^1.0.2",
    "express-winston": "^2.4.0",
    "helmet": "^3.9.0",
    "http-status": "^1.0.1",
    "joi": "^10.6.0",
    "jwt-simple": "^0.5.1",
    "lodash": "^4.17.4",
    "method-override": "^2.3.10",
    "moment": "^2.20.1",
    "moment-timezone": "^0.5.14",
    "mongoose": "^4.13.7",
    "morgan": "^1.9.0",
    "morgan-body": "^2.0.2",
    "mysql": "^2.15.0",
    "mysql2": "^1.5.1",
    "nedb": "^1.8.0",
    "node-geocoder": "^3.21.1",
    "only": "0.0.2",
    "passport": "^0.4.0",
    "passport-jwt": "^3.0.1",
    "pm2": "^2.9.1",
    "readline-sync": "^1.4.7",
    "request-promise": "^4.2.2",
    "sequelize": "^4.28.6",
    "serve-favicon": "^2.4.5",
    "winston": "^2.4.0",
    "yarn": "^1.3.2"
  },
  "devDependencies": {
    "apidoc": "^0.17.5",
    "chai": "^4.1.2",
    "chai-as-promised": "^7.1.1",
    "coveralls": "^2.13.1",
    "eslint": "^4.13.1",
    "eslint-config-airbnb-base": "^12.1.0",
    "eslint-plugin-import": "^2.8.0",
    "husky": "^0.14.3",
    "mocha": "^3.5.3",
    "nodemon": "^1.14.1",
    "nyc": "^11.4.1",
    "opn-cli": "^3.1.0",
    "sinon": "^3.3.0",
    "sinon-chai": "^2.14.0",
    "supertest": "^3.0.0"
  },
  "license": "MIT"
}

纱锁 https://pastebin.com/vTrLHWff

1 个答案:

答案 0 :(得分:0)

尝试同时删除node_modulesyarn.lock

rm -rf node_modulesrm yarn.lock

然后尝试运行: npm run rebuild似乎有助于解决问题。