我已经将angular项目从一台计算机迁移到另一台计算机,当我运行"npm i"时,它会给我这些错误


$ npm install
npm ERR! code EJSONPARSE
npm ERR! file /home/germanus/Documents/Angular_projects/demoproj/package.json
npm ERR! JSON.parse Failed to parse json
npm ERR! JSON.parse Unexpected token  in JSON at position 0 while parsing near '...'
npm ERR! JSON.parse Failed to parse package.json data.
npm ERR! JSON.parse package.json must be actual JSON, not just JavaScript.
npm ERR! A complete log of this run can be found in:
npm ERR!     /home/germanus/.npm/_logs/2021-04-17T09_15_03_006Z-debug.log
delete package-lock.json
npm clear -f cache
npm i

删除node_modules文件夹和package-lock.json文件,然后执行以下命令可以解决问题:

npm install

它应该重新生成node_modules文件夹和package-lock.json文件。

相关内容

最新更新