【问题标题】:bower in VS2017 is not workingVS2017 中的凉亭不工作
【发布时间】:2017-12-28 21:43:25
【问题描述】:

当我使用 bower manager 安装“animate”包时,出现异常:

EMALFORMED Failed to read C:\Users\Frank\AppData\Local\Temp\FRANK-PC-Frank\bower\a2a424217f809672e8fe80ddeab36781-21084-Ho4ioc\bower.json Additional error details: Unexpected token }

我不知道为什么 bower.cmd 没有在项目中修改 bower.json。似乎想修改临时 bower.json(我找不到它,使用 bower logger 提供的路径)。

如何解决?以及为什么 bower 包管理器不好用?

完整日志(vs2017 v15.2)如下:

PATH=.\node_modules\.bin;D:\Program Files (x86)\Microsoft Visual 
Studio\2017\Enterprise\Web\External;%PATH%;D:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git\cmd;D:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git\mingw32\bin
"D:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Web\External\Bower.cmd" install --force-latest
bower animate#*             not-cached https://github.com/joshuapekera/animate.git#*
bower animate#*                resolve https://github.com/joshuapekera/animate.git#*
bower animate#*               checkout 1.0.1

bower animate#1.0.1           progress Receiving objects:   8% (51/635)
bower animate#1.0.1           progress Receiving objects:  10% (68/635), 220.01 KiB | 164.00 KiB/s
bower animate#1.0.1           progress Receiving objects:  12% (77/635), 332.01 KiB | 158.00 KiB/s
bower animate#1.0.1           progress Receiving objects:  12% (80/635), 620.01 KiB | 228.00 KiB/s
bower animate#1.0.1           progress Receiving objects:  13% (85/635), 1020.01 KiB | 236.00 KiB/s
bower animate#1.0.1           progress Receiving objects:  13% (86/635), 1.12 MiB | 237.00 KiB/s
bower animate#1.0.1           progress Receiving objects:  13% (87/635), 1.39 MiB | 256.00 KiB/s
bower animate#1.0.1           progress Receiving objects:  14% (89/635), 1.63 MiB | 273.00 KiB/s
bower animate#1.0.1           progress Receiving objects:  14% (94/635), 1.96 MiB | 259.00 KiB/s
bower animate#1.0.1           progress Receiving objects:  15% (96/635), 2.34 MiB | 282.00 KiB/s
bower animate#1.0.1           progress Receiving objects:  41% (261/635), 2.86 MiB | 339.00 KiB/s
bower animate#1.0.1           progress Receiving objects:  59% (375/635), 3.24 MiB | 386.00 KiB/s
bower animate#1.0.1           progress Receiving objects:  96% (610/635), 4.14 MiB | 517.00 KiB/s
bower animate#1.0.1         EMALFORMED Failed to read C:\Users\Frank\AppData\Local\Temp\FRANK-PC-Frank\bower\a2a424217f809672e8fe80ddeab36781-21084-Ho4ioc\bower.json
Additional error details:
Unexpected token }

在VS2017 Preview中更新日志:

PATH=.\node_modules\.bin;C:\Program Files (x86)\Microsoft Visual Studio\Preview\Enterprise\Web\External;%PATH%;C:\Program Files (x86)\Microsoft Visual Studio\Preview\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git\cmd;C:\Program Files (x86)\Microsoft Visual Studio\Preview\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git\mingw32\bin
"C:\Program Files (x86)\Microsoft Visual Studio\Preview\Enterprise\Web\External\Bower.cmd" install animate#1.0.1 --force-latest --save
bower bootstrap#3.3.7       not-cached https://github.com/twbs/bootstrap.git#3.3.7
bower bootstrap#3.3.7          resolve https://github.com/twbs/bootstrap.git#3.3.7
bower animate#1.0.1         not-cached https://github.com/joshuapekera/animate.git#1.0.1
bower animate#1.0.1            resolve https://github.com/joshuapekera/animate.git#1.0.1
bower animate#1.0.1           checkout 1.0.1
bower bootstrap#3.3.7         checkout v3.3.7
bower animate#1.0.1           progress Receiving objects:  72% (127/176), 900.00 KiB | 164.00 KiB/s
bower animate#1.0.1           progress Receiving objects:  80% (141/176), 1.14 MiB | 183.00 KiB/s
bower bootstrap#3.3.7         resolved https://github.com/twbs/bootstrap.git#3.3.7
bower animate#1.0.1         EMALFORMED Failed to read C:\Users\Frank\AppData\Local\Temp\DESKTOP-CBTHUS9-Frank\bower\a2a424217f809672e8fe80ddeab36781-12852-ixWkIa\bower.json
Additional error details:
Unexpected token }

【问题讨论】:

    标签: asp.net-core-mvc bower visual-studio-2017 bower-install asp.net-core-1.1


    【解决方案1】:

    我遇到了类似的问题。就我而言,这是 Visual Studio 2017 中的一个错误。我更新到了最新版本的 Visual Studio 2017 (15.3),之后它运行良好。

    您可能需要删除 bower.json 文件中的依赖项,然后在更新后通过管理 Bower 包重新添加它们。

    【讨论】:

      【解决方案2】:

      我通过手动删除 bower.json 的“依赖项”属性中的所有条目、所有尾随回车符和空格来解决此问题。之后,我右键单击 bower.json 并使用“管理 Bower 包...”并通过该工具重新安装这些包。之后,右键单击“Restore Packages”即可成功检索它们。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-08-12
        • 1970-01-01
        • 2014-02-24
        • 1970-01-01
        • 1970-01-01
        • 2017-03-14
        相关资源
        最近更新 更多