创建新的Angular 5项目时:

node 版本:8.9.2

npm版本:5.5.1

我的命令是:

npm install -g @angular/cli

错误是:

npm ERR! **Unexpected end of JSON input while parsing near '...nt-webpack-plugin":"0'**
npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Aashitec\AppData\Roaming\npm-cache\_logs\2017-12-06T13_10_10_729Z-debug.log

The error log is here

推荐答案

这为我解决了问题:

打开Windows Powershell as admin

npm cache clean --force
npm install -g @angular/cli

https://devblogs.microsoft.com/premier-developer/getting-started-with-node-js-angular-and-visual-studio-code/

Node.js相关问答推荐

如何将信号从终端窗口发送到运行在Raspberry Pi上的Puppeteer/Node.js上的webscraper

如何使用MongoDB在Node.js 中向数组中添加项?

(0,core_1.default)不是使用@middy/core的lambda处理程序上的函数

Node js 处理回调和 Promise

TS[2339]:类型 '() => Promise<(Document & Omit) | 上不存在属性空>'

Prisma 和 Nextjs:重新部署之前内容不会更新

使用单个 MongoDB 查询更新多个元素

是否可以在 NodeJS 代码库中的每个函数之前和之后添加 console.log?

发布请求不使用 Nodejs 更新 MongoDB 中的标头信息

Docker node_modules 文件夹上的 React 应用程序不可用

为什么当我使用waitForSelector时 Puppeteer 导致我的测试套件挂起 30 秒,即使我在页面和浏览器上调用关闭?

在 Header 中使用 Authorization 方法和新的附加参数:accessToken 有什么区别?

对 google api v3 的 Axios 请求返回加密(?)数据

在 Atlas 触发器(Node JS)中正确初始化 Firebase 管理 SDK

如何在不使用位置运算符 $ 的情况下更新 mongodb 文档中数组中的嵌套文档?

如何让 vscode 假设一个 node.js 上下文,以便它不假设 `fetch` 存在?

类 WebSwapCGLLayer 在 Mac OS X /System 和 node_modules 中都实现了

Mongoose,如何一次更新多个?

如何运行用 TypeScript 编写的 Mocha 测试?

未在 Windows 8.1 上构建的 node 包 - 缺少 Microsoft.Cpp.Default.props