找不到类型 [Newtonsoft.Json.Linq.JObject]



我使用Install-Module -Name newtonsoft.json即便如此,它也会显示错误。我什至尝试了Add-Type -AssemblyName Newtonsoft.Json.Linq.JObject没有任何效果。请帮忙!

PS C:Usersm-00261-2>   `$rawJson = [Newtonsoft.Json.Linq.JObject]::Parse($rawString)`
Unable to find type [Newtonsoft.Json.Linq.JObject].
At line:1 char:14
+   $rawJson = [Newtonsoft.Json.Linq.JObject]::Parse($rawString)
+              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidOperation: (Newtonsoft.Json.Linq.JObject:TypeName) [], RuntimeException
+ FullyQualifiedErrorId : TypeNotFound

PS C:Usersm-00261-2> `Add-Type -AssemblyName Newtonsoft.Json.Linq.JObject`
Add-Type : Cannot add type. The assembly 'Newtonsoft.Json.Linq.JObject' could not be found.
At line:1 char:1
+ Add-Type -AssemblyName Newtonsoft.Json.Linq.JObject
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : ObjectNotFound: (Newtonsoft.Json.Linq.JObject:String) [Add-Type], Exception
+ FullyQualifiedErrorId : ASSEMBLY_NOT_FOUND,Microsoft.PowerShell.Commands.AddTypeCommand

尝试添加一个语句Import-Module newtonsoft.json.
这为我解决了类似的问题。

相关内容

最新更新