javascript - 依赖项的非确定性行为 - nodejs

标签 javascript node.js express npm yarnpkg

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

warning Pattern ["esprima-fb@~3001.0001.0000-dev-harmony-fb"] is trying to unpack in the same destination "/Users/Me/Library/Caches/Yarn/v1/npm-esprima-fb-3001.1.0-dev-harmony-fb-b77d37abcd38ea0b77426bb8bc2922ce6b426411" as pattern ["esprima-fb@~3001.1.0-dev-harmony-fb"]. This could result in a non deterministic behavior, skipping.



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

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

最佳答案

尝试同时删除 node_modulesyarn.lock :
rm -rf node_modulesrm yarn.lock
然后尝试运行:npm run rebuild这似乎有助于解决问题。

关于javascript - 依赖项的非确定性行为 - nodejs,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48148599/

相关文章:

node.js - NodeJS Passport 在本地身份验证后不会重定向

node.js - 如何使用 chromeless API 从下拉列表中选择一个选项?

javascript - NodeJS Express 反向代理 TLS_CERT_ALTNAME_INVALID 错误

javascript - 如何通过代理或作为中间件来操作 socket.io 数据?

node.js - 如何组合两个都需要监听端口的 Express 模块?

javascript - 根据特定标准从字符串中提取子字符串的有效方法?

JavaScript:将 Json 数据数组更改为新格式

javascript - 在桌面和移动设备上运行相同的脚本

javascript - 在 Three.js 中为几何体中的顶点分配颜色

node.js - 如何在重定向 Express 4 之前找到原始请求路径