1

我需要安装远程存储库的子目录作为我的节点依赖项。

根据这个问题,可以将 GitHub 存储库的子目录安装为 yarn 2.xx https://github.com/yarnpkg/yarn/issues/4725的依赖项

但是,运行yarn add https://github.com/mklueh/gridsome/tree/master/gridsome.git会产生

Internal Error: Invalid descriptor (git+https://github.com/mklueh/gridsome/tree/master/gridsome.git)
    at Module.x (C:\Users\MyPc\Workspace\myproject\.yarn\releases\yarn-2.4.1.cjs:2:435195)
    at C:\Users\MyPc\Workspace\myproject\.yarn\releases\yarn-2.4.1.cjs:2:30958
    at Array.map (<anonymous>)
    at M.execute (C:\Users\MyPc\Workspace\myproject\.yarn\releases\yarn-2.4.1.cjs:2:30866)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async M.validateAndExecute (C:\Users\MyPc\Workspace\myproject\.yarn\releases\yarn-2.4.1.cjs:2:660570)
    at async Y.run (C:\Users\MyPc\Workspace\myproject\.yarn\releases\yarn-2.4.1.cjs:17:3854)
    at async Y.runExit (C:\Users\MyPc\Workspace\myproject\.yarn\releases\yarn-2.4.1.cjs:17:4021)
    at async h (C:\Users\MyPc\Workspace\myproject\.yarn\releases\yarn-2.4.1.cjs:2:285303)
    at async r (C:\Users\MyPc\Workspace\myproject\.yarn\releases\yarn-2.4.1.cjs:2:283914)

这是子模块的 package.json。

{
  "version": "0.7.23",
  "name": "gridsome",
  "description": "A JAMstack framework for building blazing fast websites with Vue.js",
  "homepage": "https://gridsome.org",
  "repository": "https://github.com/gridsome/gridsome",
  "bugs": "https://github.com/gridsome/gridsome/issues",
  "license": "MIT",
  "main": "index.js",
  "browser": "app/index.js",
  "bin": {
    "gridsome": "./bin/gridsome.js"
  },
  "keywords": [
    "vue",
    "gridsome",
    "static site generator",
    "jamstack",
    "website",
    "blog"
  ],
  "dependencies": {
    "@babel/code-frame": "^7.5.5",
    "@babel/core": "^7.0.0",
    "@gridsome/cli": "^0.3.4",
    "@hapi/joi": "^15.1.1",
    "@sindresorhus/slugify": "^1.1.0",
    "@vue/babel-preset-app": "^4.2.2",
    "@vue/component-compiler-utils": "^2.5.2",
    "address": "^1.1.0",
    "auto-bind": "^2.0.0",
    "autoprefixer": "^9.4.7",
    "babel-loader": "8.0.5",
    "cache-loader": "^2.0.1",
    "camelcase": "^5.0.0",
    "case-sensitive-paths-webpack-plugin": "^2.2.0",
    "chalk": "^2.4.2",
    "chokidar": "^3.4.2",
    "color-string": "^1.5.3",
    "columnify": "^1.5.4",
    "connect-history-api-fallback": "^1.6.0",
    "core-js": "^3.6.4",
    "css-loader": "^2.1.0",
    "devcert": "^1.1.0",
    "dotenv": "^6.2.0",
    "enhanced-resolve": "4.1.1",
    "eventemitter3": "^3.1.0",
    "express": "^4.16.4",
    "express-graphql": "^0.12.0",
    "fastest-levenshtein": "^1.0.12",
    "file-loader": "^3.0.1",
    "friendly-errors-webpack-plugin": "^1.7.0",
    "fs-extra": "^7.0.1",
    "globby": "^9.0.0",
    "graphql": "^15.5.0",
    "graphql-compose": "7.20.1",
    "graphql-playground-middleware-express": "^1.7.12",
    "hash-sum": "^1.0.2",
    "hirestime": "^3.2.1",
    "html-webpack-plugin": "^3.2.0",
    "invariant": "^2.2.4",
    "is-relative": "^1.0.0",
    "is-url": "^1.2.4",
    "jest-worker": "24.0.0",
    "json-loader": "^0.5.7",
    "loader-utils": "^1.2.3",
    "lodash": "^4.17.11",
    "lokijs": "^1.5.6",
    "lru-cache": "^5.1.1",
    "md5-file": "^4.0.0",
    "mime-types": "^2.1.21",
    "mini-css-extract-plugin": "^0.5.0",
    "moment": "^2.24.0",
    "optimize-css-assets-webpack-plugin": "^5.0.1",
    "p-map": "^2.0.0",
    "path-to-regexp": "^2.2.1",
    "physical-cpu-count": "^2.0.0",
    "pnp-webpack-plugin": "^1.6.4",
    "portfinder": "^1.0.20",
    "postcss-loader": "^3.0.0",
    "potrace": "^2.1.8",
    "probe-image-size": "^4.0.0",
    "resolve-from": "^5.0.0",
    "sharp": "^0.28.1",
    "slash": "^2.0.0",
    "sockjs": "^0.3.19",
    "sockjs-client": "^1.3.0",
    "stack-trace": "^0.0.10",
    "svgo": "^2.2.2",
    "tapable": "2.0.0-beta.5",
    "url-loader": "^1.1.2",
    "vue": "^2.6.10",
    "vue-loader": "^15.7.1",
    "vue-meta": "^2.2.2",
    "vue-router": "^3.1.3",
    "vue-server-renderer": "^2.6.10",
    "vue-style-loader": "^4.1.2",
    "vue-template-compiler": "^2.6.10",
    "webpack": "^4.29.3",
    "webpack-chain": "^5.2.0",
    "webpack-dev-middleware": "^3.5.2",
    "webpack-hot-middleware": "^2.24.3",
    "webpack-merge": "^4.2.1",
    "yaml-loader": "^0.5.0"
  },
  "peerDependencies": {
    "less-loader": "*",
    "sass-loader": "*",
    "stylus-loader": "*"
  },
  "peerDependenciesMeta": {
    "sass-loader": {
      "optional": true
    },
    "less-loader": {
      "optional": true
    },
    "stylus-loader": {
      "optional": true
    }
  },
  "engines": {
    "node": ">=8.3"
  },
  "contributors": [
    {
      "name": "Tommy Vedvik (@tomtev)"
    },
    {
      "name": "Hans-Jørgen Vedvik (@hjvedvik)"
    }
  ]
}

这里出了什么问题?远程存储库是否需要调整才能与纱线 2 一起使用?

4

0 回答 0