Angular启动项目时报错
Angular启动项目时报错An unhandled exception occurred: Cannot find module ‘acorn’
之前查看网上教程,教程需要引入@angular/http,初学Angular还不是很了解Angular8已经换成HttpClient,不需要引入angular/http,于是在cmd中运行了npm install @angular/http,再次使用ng s启动项目时报错An unhandled exception occurred: Cannot find module ‘acorn’
解决
1.提示找不到Module ‘acorn’,那就安装呗,代码如下
npm install -save-dev acorn
2.装着装着提示error,显示有文件存在
直接进入给出的路径 F:\Workspaces\Angular\angulardemo01\node_modules.bin
然后把里面东西全部删除
3.再次安装
npm install -save-dev acorn
这次成功了
4.试着运行
ng s
报错了
5.重新引入依赖
yarn
(我用的是yarn,其实用npm i,cnpm i都行)
6.安装完成之后再次运行,成功
产生原因:
可能是由于之前使用过cnpm进行安装,产生了冲突
参考了博文:
[1]: https://blog.csdn.net/weixin_42740530/article/details/105990467?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-2.channel_param&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-2.channel_param
- Maven 项目启动 Tomcat 时报丢失jar包解决方法
- tomcat主页与新加入项目启动时报404
- maven项目(错误一) 项目启动时报“org.springframework.core.env.ConfigurableEnvironment”的解决方案
- angular4开发环境搭建以及项目启动过程
- mybatis(错误) 项目启动时报“Result Maps collection already contains value forxxx”的解决方案
- 工作总结32 xfire-servlet.xml项目启动加载时报cvc-elt.1:找不到元素“beans”的声明
- JAVA-spring boot项目启动时报错
- mybatis(错误一) 项目启动时报“Result Maps collection already contains value forxxx”的解决方案
- 3 Angular 2 快速上手启动项目Demo
- tomcat启动java web项目时报…
- 启动项目时报 Error configuring application listener of class cn.com.XXX.listener.InitListener 错误
- mybatis(错误一) 项目启动时报“Result Maps collection already contains value forxxx”的解决方案
- eclipse启动项目时报PermGen space内存溢出
- Spring Boot项目启动时报错:command line is too long
- 【Angular2】NiceFish美人鱼项目启动遇到的问题
- 用ssh框架写项目时tomcat启动时报错严重: Error configuring application listener of class [org.springframework.web.co
- mybatis 项目启动时报“Result Maps collection already contains value forxxx”错误
- 启动spring boot项目时报错:java.lang.ClassNotFoundException: javax.servlet.Filter
- mybatis(错误一) 项目启动时报“Result Maps collection already contains value forxxx”的解决方案
- mybatis(错误一) 项目启动时报“Result Maps collection already contains value forxxx”的解决方案