使用angular cli
创建新应用时遇到错误我试过了:
npm cache clean --force
npm cache verify
但它无效
请看下面的图片
日志:
2174 verbose stack SyntaxError: Unexpected end of JSON input while parsing near '...ul-reporter","version'
2174 verbose stack at JSON.parse (<anonymous>)
2174 verbose stack at parseJson (C:\Program Files\nodejs\node_modules\npm\node_modules\pacote\node_modules\make-fetch-happen\node_modules\node-fetch-npm\node_modules\json-parse-better-errors\index.js:7:17)
2174 verbose stack at consumeBody.call.then.buffer (C:\Program Files\nodejs\node_modules\npm\node_modules\pacote\node_modules\make-fetch-happen\node_modules\node-fetch-npm\src\body.js:96:50)
2174 verbose stack at <anonymous>
2174 verbose stack at process._tickCallback (internal/process/next_tick.js:188:7)
2175 verbose cwd C:\Users\nielcleoa\Desktop\appsample
2176 verbose Windows_NT 6.1.7601
2177 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "--quiet"
2178 verbose node v8.11.3
2179 verbose npm v5.6.0
2180 error Unexpected end of JSON input while parsing near '...ul-reporter","version'
2181 verbose exit [ 1, true ]
使用的版本:
node version: 8.11.3
npm version: 5.6.0
angular-cli version: 6.0.8
答案 0 :(得分:0)
试试这个。
npm uninstall -g angular-cli
npm cache clean
npm install -g angular-cli@latest
答案 1 :(得分:0)
您是否要安装Angular2 + CLI?
如果是这样,这是命令:
npm install -g @angular/cli
以上注释中的命令是旧的AngularJS CLI,即:npm install -g angular-cli
。