我已在我的package.json
"devDependencies": {
...
"react-dom/test-utils": "*",
"react-test-renderer/shallow": "*"
},
建议react docs符合react
生态系统的第16版。
运行npm install --verbose
后我得到了这个:
18 verbose node v8.5.0
19 verbose npm v5.3.0
20 error code EINVALIDPACKAGENAME
21 error Invalid package name "react-dom/test-utils": name can only contain URL-friendly characters
22 verbose exit [ 1, true ]
同时尝试通过 cli 将其安装为devDependency
会出现此错误:
npm ERR! Error while executing:
npm ERR! /usr/bin/git ls-remote -h -t ssh://git@github.com/react-dom/test-utils.git
npm ERR!
npm ERR! Permission denied (publickey).
npm ERR! fatal: Could not read from remote repository.
npm ERR!
npm ERR! Please make sure you have the correct access rights
npm ERR! and the repository exists.
npm ERR!
npm ERR! exited with error code: 128
如何解决这个问题,让这些软件包可以在代码中引用?
答案 0 :(得分:4)
只需添加using System.Management.Automation;
namespace CrudGenerator.PowerShell
{
[Cmdlet(VerbsCommon.Add, "CrudOperation")]
public class CrudOperation : Cmdlet
{
[Parameter]
public OperationType Operation { get; set; }
}
public enum OperationType
{
Get,
Put,
Post,
Delete,
Search
}
}
作为依赖项:react-dom
当您导入npm install --save-dev react-dom
时,它意味着"从反应-dom包中的test-utils文件夹/文件导入"。