gpt4 book ai didi

node.js - Visual Studio 2015 社区中的 Aurelia bundle

转载 作者:太空宇宙 更新时间:2023-11-03 23:36:06 29 4
gpt4 key购买 nike

我在 package.json 中设置了 postinstall 规则,如下所示:

"postinstall": "aurelia bundle --force"

如果我从项目文件夹中的 cmd 运行 npm install,则不会显示任何错误,但当项目在 Visual Studio 2015 Community 中加载时,它会在“输出”窗口中显示以下错误(但输出捆绑文件):

---> (Inner Exception #0) Microsoft.NodejsTools.Npm.PackageJsonException: Error reading package.json at '...\node_modules\aurelia-cli\node_modules\npm\node_modules\graceful-fs\package.json': Error reading package.json. The file may be parseable JSON but may contain objects with duplicate properties.

The following error occurred:

Can not add Newtonsoft.Json.Linq.JValue to Newtonsoft.Json.Linq.JObject. ---> Microsoft.NodejsTools.Npm.PackageJsonException: Error reading package.json. The file may be parseable JSON but may contain objects with duplicate properties.

The following error occurred:

Can not add Newtonsoft.Json.Linq.JValue to Newtonsoft.Json.Linq.JObject. ---> System.ArgumentException: Can not add Newtonsoft.Json.Linq.JValue to Newtonsoft.Json.Linq.JObject.
at Newtonsoft.Json.Linq.JObject.ValidateToken(JToken o, JToken existing)
at Newtonsoft.Json.Linq.JContainer.InsertItem(Int32 index, JToken item, Boolean skipParentCheck)
at Newtonsoft.Json.Linq.JObject.InsertItem(Int32 index, JToken item, Boolean skipParentCheck)
at Newtonsoft.Json.Linq.JContainer.AddInternal(Int32 index, Object content, Boolean skipParentCheck)
at Newtonsoft.Json.Linq.JContainer.Add(Object content)
at Newtonsoft.Json.Linq.JTokenWriter.AddValue(JValue value, JsonToken token)
at Newtonsoft.Json.Linq.JTokenWriter.WriteNull()
at Newtonsoft.Json.JsonWriter.AutoCompleteClose(JsonContainerType type)
at Newtonsoft.Json.JsonWriter.WriteEndObject()
at Newtonsoft.Json.JsonWriter.WriteEnd(JsonContainerType type)
at Newtonsoft.Json.JsonWriter.WriteEnd()
at Newtonsoft.Json.JsonWriter.AutoCompleteAll()
at Newtonsoft.Json.Linq.JTokenWriter.Close()
at Newtonsoft.Json.JsonWriter.System.IDisposable.Dispose()
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateJObject(JsonReader reader)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
at Microsoft.NodejsTools.Npm.ReaderPackageJsonSource..ctor(TextReader reader)
--- End of inner exception stack trace ---
at Microsoft.NodejsTools.Npm.ReaderPackageJsonSource..ctor(TextReader reader)
at Microsoft.NodejsTools.Npm.FilePackageJsonSource..ctor(String fullPathToFile)
--- End of inner exception stack trace ---
at Microsoft.NodejsTools.Npm.FilePackageJsonSource.WrapExceptionAndRethrow(String fullPathToFile, Exception ex)
at Microsoft.NodejsTools.Npm.FilePackageJsonSource..ctor(String fullPathToFile)
at Microsoft.NodejsTools.Npm.DirectoryPackageJsonSource..ctor(String fullDirectoryPath)
at Microsoft.NodejsTools.Npm.SPI.RootPackage..ctor(String fullPathToRootDirectory, Boolean showMissingDevOptionalSubPackages)
at Microsoft.NodejsTools.Npm.SPI.NodeModules..ctor(IRootPackage parent, Boolean showMissingDevOptionalSubPackages)
at Microsoft.NodejsTools.Npm.SPI.RootPackage..ctor(String fullPathToRootDirectory, Boolean showMissingDevOptionalSubPackages)
at Microsoft.NodejsTools.Npm.SPI.NodeModules..ctor(IRootPackage parent, Boolean showMissingDevOptionalSubPackages)
at Microsoft.NodejsTools.Npm.SPI.RootPackage..ctor(String fullPathToRootDirectory, Boolean showMissingDevOptionalSubPackages)
at Microsoft.NodejsTools.Npm.SPI.NodeModules..ctor(IRootPackage parent, Boolean showMissingDevOptionalSubPackages)
at Microsoft.NodejsTools.Npm.SPI.RootPackage..ctor(String fullPathToRootDirectory, Boolean showMissingDevOptionalSubPackages)
at Microsoft.NodejsTools.Npm.SPI.NpmController.<RefreshAsync>d__1.MoveNext()<---

那么从 Visual Studio 自动运行 npm install 是否会对脚本的实际捆绑产生任何影响,因为它在自动运行时会跳过一些模块?

最佳答案

Visual Studio 2015 使用非常旧版本的 Node 和 npm。我在使用 Apache Cordova 应用程序工具时遇到了类似的问题。

你可以通过更改C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\Web Tools\External下的一些文件包括node.exe,使vs使用与cmd相同的Node和npm

寻找这篇文章http://jameschambers.com/2015/09/upgrading-npm-in-visual-studio-2015/

此外,vs 似乎不适用于最新的 5.0.0 Node。替换为4.2.2即可解决。

关于node.js - Visual Studio 2015 社区中的 Aurelia bundle ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32129931/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com