Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
657 views
in Technique[技术] by (71.8m points)

javascript - 依赖项的非确定性行为-Node.js(Non deterministic behavior on dependencies - nodejs)

I would solve a warning: when I run yarn install all dependencies are installed but I receive this warning:(我会解决一个警告:当我运行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"].(警告模式[“ 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“]。) This could result in a non deterministic behavior, skipping.(这可能导致不确定的行为,从而跳过。) If I delete node_modules folder and I run yarn install I don't receive the warning, when I re-execute yarn install I receive it again.(如果删除node_modules文件夹并运行yarn install我没有收到警告,当我重新执行yarn install时我再次收到警告。) I suppose the problem is in yarn-lock file.(我想问题出在锁纱文件中。) package.json(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" } yarn-lock https://pastebin.com/vTrLHWff(纱锁 https://pastebin.com/vTrLHWff)   ask by tinytanks translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Try removing both node_modules and yarn.lock :(尝试同时删除node_modulesyarn.lock :)

rm -rf node_modules and rm yarn.lock(rm -rf node_modulesrm yarn.lock) And then try running: npm run rebuild which seem to help to resolve the issue.(然后尝试运行: npm run rebuild似乎有助于解决问题。)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...