错误!不支持 URL 类型 "workspace:":工作区:*

npm ERR! Unsupported URL Type "workspace:": workspace:*

我正在用 gatsby 创建一个新项目

gatsby new YourProjectName2 https://github.com/Vagr9K/gatsby-advanced-starter

并得到一个错误:

info Creating new site from git:
https://github.com/Vagr9K/gatsby-advanced-starter.git

Cloning into 'YourProjectName2'...
remote: Enumerating objects: 420, done.
remote: Counting objects: 100% (420/420), done.
remote: Compressing objects: 100% (373/373), done.
remote: Total 420 (delta 44), reused 268 (delta 22), pack-reused 0
Receiving objects: 100% (420/420), 7.74 MiB | 11.79 MiB/s, done.
success Created starter directory layout
info Installing packages...

npm ERR! code EUNSUPPORTEDPROTOCOL
npm ERR! Unsupported URL Type "workspace:": workspace:*

npm ERR! A complete log of this run can be found in:

 ERROR

Command failed with exit code 1: npm install

知道如何解决这个问题 npm ERR! Unsupported URL Type "workspace:": workspace:* 吗?

我使用 yarn 而不是 npm 解决了这个问题。

可能需要检查package.json中的项目依赖版本是否出现[workspace:]。如果你使用 npm i 安装你的包,它会出现“Unsupported URL Type “workspace:”: workspace:”。如果你使用 yarn 安装包,yarn 会询问你要安装哪个版本。