描述问题
我正在尝试使用一个github网址初始化一个create-react-app
项目。
npx create-react-app my-app --use-npm --template git+ssh://git@github.com/<orgname>/<repo>.git/<folder-name>/react-scripts/cra-template-javascript
问题是我的github仓库有多个模板,我可以像这样在本地运行它们:
npx create-react-app my-app --use-npm --template file:/Users/adeelimran/Desktop/adeel/repos/sandbox/adeel_imran/react-scripts/cra-template-typescript
但是我可以通过github链接运行它,因为项目文件夹位于嵌套的github文件夹下。
你是否尝试恢复依赖项?
这个问题没有依赖项。
你在用户指南中搜索了哪些术语?
https://create-react-app.dev/docs/custom-templates
环境
Environment Info:
current version of create-react-app: 3.4.1
running from /Users/adeelimran/.npm/_npx/45395/lib/node_modules/create-react-app
System:
OS: macOS 10.15.5
CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Binaries:
Node: 14.4.0 - ~/.nvm/versions/node/v14.4.0/bin/node
Yarn: 1.22.4 - ~/.yarn/bin/yarn
npm: 6.14.5 - ~/.nvm/versions/node/v14.4.0/bin/npm
Browsers:
Chrome: 83.0.4103.106
Firefox: 64.0.2
Safari: 13.1.1
npmPackages:
react: Not Found
react-dom: Not Found
react-scripts: Not Found
npmGlobalPackages:
create-react-app: Not Found
重现问题的步骤
(在这里写下你的步骤:)
- 创建一个github仓库
- 在那个仓库里创建一些嵌套的文件夹
- 在其中一个模板中添加这里的内容 https://github.com/facebook/create-react-app/tree/master/packages/cra-template
- 在执行
npx create-react-app my-app --use-npm --template git+ssh://git@github.com/<username>/<repo-name>.git/folder1/fodler2/cra-template-javascript
时 - 它应该找到这个文件夹并使用给定的模板初始化一个CRA项目
预期行为
(写下你认为会发生什么。)
它应该从github网址读取并创建项目。
实际行为
(写下发生了什么。请添加截图!)
可复现的演示
(粘贴一个示例项目的链接和重现问题的确切说明。)
5条答案
按热度按时间dba5bblo1#
这个问题已经被自动标记为过时,因为它没有任何最近的活动。如果没有发生任何进一步的活动,它将在5天后被关闭。
0wi1tuuw2#
这个问题已经自动关闭,因为它没有任何最近的活动。如果您有问题或评论,请打开一个新的问题。
ie3xauqp3#
我不知道这个用例有多常见,但这可能是我们可以实现的东西。
s5a0g9ez4#
iansu,有没有什么方法可以帮助解决这个问题?:)
olqngx595#
如果你想提交一个PR添加这个功能,那就太好了。我刚刚在这里提交了一个影响相同代码的PR:#9412 。你需要在
getTemplateInstallPackage
函数中做一些额外的修改。