# Install fail! SyntaxError: Unexpected end of JSON input (file: xx\node_modules..\package.json的解决方法

By [BULL](https://paragraph.com/@bull-2) · 2022-08-14

---

分析 Nodejs更新到最新版，来新的项目npm install出现了这个错误。应该是缓存的问题，版本不同后加载的文件版本不同，故先删除再使用。

解决方案

1.  安装rimraf ： cnpm install rimraf -g
    
2.  执行： rimraf node\_modules
    
3.  清空缓存： npm cache clean --force
    
4.  再次安装淘宝镜像： npm install -g cnpm --registry=[https://registry.npm.taobao.org](https://registry.npm.taobao.org)
    
5.  再次执行：cnpm install ———————————————— 版权声明：本文为CSDN博主「chelflan」的原创文章，遵循CC 4.0 BY-SA版权协议，转载请附上原文出处链接及本声明。 原文链接：[https://blog.csdn.net/qq\_31001889/article/details/104242948](https://blog.csdn.net/qq_31001889/article/details/104242948)

---

*Originally published on [BULL](https://paragraph.com/@bull-2/install-fail-syntaxerror-unexpected-end-of-json-input-file-xx-node-modules-package-json)*
