简体   繁体   English

ng serve上的angular / compiler-cli错误:找不到模块“ rxjs / Observable”

[英]angular/compiler-cli error on ng serve: cannot find module “rxjs/Observable”

It was running fine until I wanted to push to heroku, then heroku gave me an error and said to update. 在我想推送到heroku之前,它运行良好,然后heroku给我一个错误并说要更新。 So I did, then I'm getting this error on my local when I run ng serve or npm start . 所以我做到了,然后当我运行ng servenpm start时,在本地出现此错误。 The @angular/compiler-cli" package as not properly installed. Error: Error: cannot find module "rxjs/Observable"

Things I've tried: 我尝试过的事情:

  • ran npm uninstall @angular/compiler-cli 运行npm uninstall @angular/compiler-cli
  • then install npm install --save-dev @angular/compiler-cli 然后安装npm install --save-dev @angular/compiler-cli
  • installed rxjs 已安装的rxjs

same error 同样的错误

  • delete @angular/compiler-cli in node_modules node_modules删除@ angular / compiler-cli
  • install npm install --save-dev @angular/compiler-cli 安装npm install --save-dev @angular/compiler-cli

Also ran npm cache clean and npm cache clear also tried it with --force 还运行了npm cache cleannpm cache clear也用--force尝试过

In these kind of cases best thing is to delete node_modules (and package-lock.json if you have one, which you would if you have NPM 5), and run npm install again. 在这种情况下,最好的办法是删除node_modules (如果有,则删除package-lock.json如果有NPM 5,则删除package-lock.json ),然后再次运行npm install

You'll need to have the package.json file as you had it at the last known good state for this to work. 您需要拥有package.json文件,就像在上一个已知的良好状态下一样,此文件才能起作用。 Assuming you are using git. 假设您正在使用git。

If this is a pet project and you didn't push to git etc, try creating a new Angular CLI project in a new folder and copying src/ and .angular-cli.json to it. 如果这是一个宠物项目,并且您没有按git等操作,请尝试在新文件夹中创建一个新的Angular CLI项目,然后将src/.angular-cli.json复制到其中。 You might need to reinstall any 3rd party NPM packages your project used into the new project. 您可能需要将您的项目使用的所有第三方NPM软件包重新安装到新项目中。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在 ng serve 找不到模块“@angular/compiler-cli/ngcc” - Cannot find module '@angular/compiler-cli/ngcc' at ng serve Angular 运行 NG SERVE 出现错误找不到模块'@angular/compiler-cli/src/tooling' - Angular run NG SERVE get a error Cannot find module '@angular/compiler-cli/src/tooling' 由于错误“无法找到模块‘@angular/compiler-cli’”,无法运行 ng serve - Can't run ng serve because of error "Cannot find module '@angular/compiler-cli'" 我在尝试执行 ng serve 时收到此错误“发生未处理的异常:找不到模块'@angular/compiler-cli' - I Get this error when im trying to execute ng serve "An unhandled exception occurred: Cannot find module '@angular/compiler-cli' 运行 ng serve 时找不到模块“@angular/compiler-cli/ngc” - cannot find module '@angular/compiler-cli/ngc' when I run ng serve 发生未处理的异常:无法使用 ng serve 找到模块“@angular/compiler-cli” - An unhandled exception occurred: Cannot find module '@angular/compiler-cli' with ng serve 在我的应用程序上运行“ng serve”时“找不到模块‘@angular/compiler-cli/ngcc’” - "Cannot find module '@angular/compiler-cli/ngcc'" when running "ng serve" on my app 错误:找不到模块'@angular/compiler-cli/linker' - Error: Cannot find module '@angular/compiler-cli/linker' 错误:找不到模块'@angular/compiler-cli - Error: Cannot find module '@angular/compiler-cli Ionic4 / Angular - 在 Ionic 服务上找不到模块“@angular/compiler-cli/ngcc” - Ionic4 / Angular - Cannot find module '@angular/compiler-cli/ngcc' on Ionic serve
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM