从另一台计算机复制后,我的Angular项目产生错误

时间:2018-12-17 05:48:11

标签: angular

  

您的全局Angular CLI版本(7.1.1)大于本地版本   版本(7.0.7)。使用本地Angular CLI版本。

To disable this warning use "ng config -g cli.warnings.versionMismatch false".
Error parsing C:\Users\admin\Desktop\Projectname\node_modules\webpack- 
sources\package.json: Unexpected token   in JSON at position 0
SyntaxError: Error parsing C:\Users\admin\Desktop\Projectname\node_modules\webpack-sources\package.json: Unexpected token   in JSON at position 0
at JSON.parse (<anonymous>)
at readPackage (module.js:126:52)
at tryPackage (module.js:136:13)
at Function.Module._findPath (module.js:218:20)
at Function.Module._resolveFilename (module.js:545:25)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (C:\Users\admin\Desktop\Projectname\node_modules\webpack\lib\Compilation.js:9:26)
at Module._compile (module.js:652:30)`

由于我是Angle的新手,所以无法理解这一点,所以请帮助我!

1 个答案:

答案 0 :(得分:1)

忽略cli警告

1.Delete node_modules and package-lock-json. 
2.npm install.

如果不能解决问题,这应该可以解决问题,

npm uninstall -g @angular/cli (add sudo in the start if using Linux)
npm cache clean --force / npm cache verify
npm install -g @angular/cli

希望这会有所帮助。