为什么 Yarn 在安装依赖项时会报错,而 NPM 不会?

Why does Yarn raise an error when installing dependencies, but NPM does not?

我决定试试 Yarn 并关闭 NPM。不幸的是,我似乎有某种写权限失败,而且这个错误对我来说太神秘了,我无法理解。现在也没有很多关于这方面的信息。在尝试 运行 yarnyarn install 甚至 yarn cache clean 之后,我仍然 运行 进入同样的错误:

Trace: 
  Error: EISDIR: illegal operation on a directory, read
      at Error (native)

这是我的 yarn-error.log 文件的全部内容:

Arguments: 
  /usr/local/bin/node /usr/local/bin/yarn install

PATH: 
  /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

Yarn version: 
  0.16.1

Node version: 
  6.7.0

Platform: 
  darwin x64

npm manifest: 
  {
    "name": "PinkBook",
    "version": "1.0.0",
    "description": "",
    "main": "index.js",
    "private": true,
    "scripts": {
      "deploy": "webpack; aws s3 cp ./dist/bundle.js s3://pinkbook",
      "dev": "webpack-dev-server --devtool eval --progress --quiet --colors --inline --hot --content-base dist/",
      "test": "jest",
      "start": "npm-run-all --parallel dev test"
    },
    "keywords": [],
    "author": "merLO <iliareingold@gmail.com>",
    "license": "ISC",
    "jest": {
      "rootDir": "./src",
      "moduleNameMapper": {
        "^.+\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/__mocks__/fileMock.js",
        "^.+\.(css|scss)$": "identity-obj-proxy"
      },
      "verbose": true
    },
    "devDependencies": {
      "babel-core": "^6.17.0",
      "babel-eslint": "^7.0.0",
      "babel-jest": "^16.0.0",
      "babel-loader": "^6.2.5",
      "babel-plugin-transform-object-rest-spread": "^6.16.0",
      "babel-preset-es2015": "^6.16.0",
      "babel-preset-react": "^6.16.0",
      "babel-preset-stage-1": "^6.16.0",
      "babel-register": "^6.16.3",
      "css-loader": "^0.25.0",
      "enzyme": "^2.4.1",
      "eslint": "^3.8.1",
      "eslint-config-airbnb": "^12.0.0",
      "eslint-plugin-import": "^2.0.1",
      "eslint-plugin-jsx-a11y": "^2.2.3",
      "eslint-plugin-react": "^6.4.1",
      "file-loader": "^0.9.0",
      "identity-obj-proxy": "^3.0.0",
      "jest": "^16.0.1",
      "json-loader": "^0.5.4",
      "node-sass": "^3.10.1",
      "npm-run-all": "^3.1.0",
      "open": "0.0.5",
      "open-browser-webpack-plugin": "0.0.2",
      "react-addons-test-utils": "^15.3.2",
      "react-dom": "^15.3.2",
      "redux-devtools": "^3.3.1",
      "sass-loader": "^4.0.2",
      "style-loader": "^0.13.1",
      "tap-nyan": "0.0.2",
      "url-loader": "^0.5.7",
      "webpack": "^1.13.2",
      "webpack-dev-server": "^1.16.2"
    },
    "dependencies": {
      "amazon-cognito-identity-js": "^1.6.0",
      "babel-polyfill": "^6.16.0",
      "material-ui": "^0.16.0",
      "react": "^15.3.2",
      "react-dom": "^15.3.2",
      "react-redux": "^4.4.5",
      "react-router": "^2.8.1",
      "react-tap-event-plugin": "^1.0.0",
      "redux": "^3.6.0",
      "redux-thunk": "^2.1.0"
    },
    "repository": {
      "url": "git@bitbucket.org:ilrein/pinkbookserverless.git",
      "type": "git"
    }
  }

yarn manifest: 
  No manifest

bower manifest: 
  No manifest

Lockfile: 
  No lockfile

Trace: 
  Error: EISDIR: illegal operation on a directory, read
      at Error (native)

https://github.com/yarnpkg/yarn/issues/653

Yarn 有一个错误,如果一个 npm 包有一个无效的属性,它就会爆炸,或者如果它有冲突的名称。最常见的是 'License' 属性,但它也可以是带有 README 目录和 README.md 的包。因此,在你的依赖树中的某个地方,有一个可能没有 License 属性的流氓包,你必须回到使用 NPM 直到 Yarn 被修补。

较新版本的 yarn 确实解决了我的问题。我遵循了上述答案中提到的所有内容。但这是添加到它。