[英]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 serve
或npm start
时,在本地出现此错误。 The @angular/compiler-cli" package as not properly installed. Error: Error: cannot find module "rxjs/Observable"
Things I've tried: 我尝试过的事情:
npm uninstall @angular/compiler-cli
运行npm uninstall @angular/compiler-cli
npm install --save-dev @angular/compiler-cli
然后安装npm install --save-dev @angular/compiler-cli
same error 同样的错误
node_modules
在node_modules
删除@ angular / compiler-cli 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 clean
和npm 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.