NodeJS 在ngx-toastr中未找到模块

pxiryf3j  于 2023-01-25  发布在  Node.js
关注(0)|答案(4)|浏览(130)

我找不到答案。

ERROR in ./node_modules/ngx-toastr/fesm5/ngx-toastr.js
Module not found: Error: Can't resolve '/Users/vasanthan/Mean projects/node_modules/@angular/animations' in '/Users/vasanthan/Mean projects/MEAN-Library/node_modules/ngx-toastr/fesm5'
ERROR in ./node_modules/ngx-toastr/fesm5/ngx-toastr.js
Module not found: Error: Can't resolve '/Users/vasanthan/Mean projects/node_modules/@angular/common' in '/Users/vasanthan/Mean projects/MEAN-Library/node_modules/ngx-toastr/fesm5'
ERROR in ./src/app/app.module.ts
Module not found: Error: Can't resolve '/Users/vasanthan/Mean projects/node_modules/@angular/common/http' in '/Users/vasanthan/Mean projects/MEAN-Library/src/app'
ERROR in ./node_modules/ngx-toastr/fesm5/ngx-toastr.js
Module not found: Error: Can't resolve '/Users/vasanthan/Mean projects/node_modules/@angular/core' in '/Users/vasanthan/Mean projects/MEAN-Library/node_modules/ngx-toastr/fesm5'
ERROR in ./src/main.ts
Module not found: Error: Can't resolve '/Users/vasanthan/Mean projects/node_modules/@angular/core' in '/Users/vasanthan/Mean projects/MEAN-Library/src'
ERROR in ./src/app/app.module.ts
Module not found: Error: Can't resolve '/Users/vasanthan/Mean projects/node_modules/@angular/core' in '/Users/vasanthan/Mean projects/MEAN-Library/src/app'
ERROR in ./src/app/app.component.ts
Module not found: Error: Can't resolve '/Users/vasanthan/Mean projects/node_modules/@angular/core' in '/Users/vasanthan/Mean projects/MEAN-Library/src/app'
ERROR in ./src/app/app.module.ts
Module not found: Error: Can't resolve '/Users/vasanthan/Mean projects/node_modules/@angular/http' in '/Users/vasanthan/Mean projects/MEAN-Library/src/app'
ERROR in ./node_modules/ngx-toastr/fesm5/ngx-toastr.js
Module not found: Error: Can't resolve '/Users/vasanthan/Mean projects/node_modules/@angular/platform-browser' in '/Users/vasanthan/Mean projects/MEAN-Library/node_modules/ngx-toastr/fesm5'
ERROR in ./src/app/app.module.ts
Module not found: Error: Can't resolve '/Users/vasanthan/Mean projects/node_modules/@angular/platform-browser' in '/Users/vasanthan/Mean projects/MEAN-Library/src/app'
ERROR in ./src/main.ts
Module not found: Error: Can't resolve '/Users/vasanthan/Mean projects/node_modules/@angular/platform-browser-dynamic' in '/Users/vasanthan/Mean projects/MEAN-Library/src'
ERROR in ./src/app/app.module.ts
Module not found: Error: Can't resolve '/Users/vasanthan/Mean projects/node_modules/@angular/platform-browser/animations' in '/Users/vasanthan/Mean projects/MEAN-Library/src/app'
ERROR in ./src/app/app.module.ts
Module not found: Error: Can't resolve '/Users/vasanthan/Mean projects/node_modules/@angular/router' in '/Users/vasanthan/Mean projects/MEAN-Library/src/app'
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! library@0.0.0 start: `ng build && node ./bin/www`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the library@0.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/vasanthan/.npm/_logs/2018-09-02T15_52_34_108Z-debug.log
qoefvg9y

qoefvg9y1#

您是否在应用程序的根目录下运行过yarn install?看起来您在node_modules文件夹中没有任何依赖项。
否则,你需要提供更多的信息。你使用的是Angular CLI吗?看起来你缺少了所有的@Angular 依赖项。

oaxa6hgo

oaxa6hgo2#

运行此命令:

npm install ngx-toastr --save
dy1byipe

dy1byipe3#

手动删除节点模块文件夹
运行npm cache clean --force
并运行npm install

s71maibg

s71maibg4#

如果有人正在使用ngx-toaster和Angular 15以及Visual Studio代码,请确保在从“ngx-toastr”导入包时

import { ToastrService } from 'ngx-toastr';

默认情况下,Visual Studio代码可从以下位置导入:

import { ToastrService } from 'ngx-toastr/public_api'; // completely wrong and it wont work

相关问题