Angular JS ngx-toastr Error: Module not found: Error: Package path ./public_api is not exported from package - angularjs

./src/app/nav/nav.component.ts:5:0-44 - Error: Module not found: Error: Package path ./public_api is not exported from package C:\Users\Score\demo\DatingApp\client\node_modules\ngx-toastr (see exports field in C:\Users\Score\demo\DatingApp\client\node_modules\ngx-toastr\package.json)
./src/app/register/register.component.ts:4:0-55 - Error: Module not found: Error: Package path ./toastr/toastr.service is not exported from package C:\Users\Score\demo\DatingApp\client\node_modules\ngx-toastr (see exports field in C:\Users\Score\demo\DatingApp\client\node_modules\ngx-toastr\package.json)
[1]: https://i.stack.imgur.com/WaZNB.png

Use this
import { ToastrService } from 'ngx-toastr';
Instade of
import { ToastrService } from 'ngx-toastr/public_api';
import { ToastrService } from 'ngx-toastr/toastr/toastr.service';

import toastService in your service file like this:
import { ToastrService } from 'ngx-toastr';

I had the same problem. I uninstalled the version I had and instead, I used this command to install the older version:
npm i ngx-toastr#14.3.0
Hope that solves it for you!

Related

how to fix ERR_UNSUPPORTED_DIR_IMPORT importing #lens-protocol/wagmi?

importing #lens-protocol/wagmi on next.js raises the following error:
Error [ERR_UNSUPPORTED_DIR_IMPORT]: Directory import '/Users/......./node_modules/#apollo/client/link/context' is not supported resolving ES modules imported from /Users/....../node_modules/#lens-protocol/api-bindings/dist/index.js
Did you mean to import #apollo/client/link/context/context.cjs?
at new NodeError (node:internal/errors:371:5)
at finalizeResolution (node:internal/modules/esm/resolve:412:17)
at moduleResolve (node:internal/modules/esm/resolve:932:10)
at defaultResolve (node:internal/modules/esm/resolve:1044:11)
at ESMLoader.resolve (node:internal/modules/esm/loader:422:30)
at ESMLoader.getModuleJob (node:internal/modules/esm/loader:222:40)
at ModuleWrap. (node:internal/modules/esm/module_job:76:40)
at link (node:internal/modules/esm/module_job:75:36) {
code: 'ERR_UNSUPPORTED_DIR_IMPORT',
url: 'file:///Users/sebastianserrano/projects/rpsocial/node_modules/#apollo/client/link/context',
page: '/'
}
Add to next.config.js the option:
transpilePackages: ['#lens-protocol'],
Until the #apollo-client fixes the ESM modules support (https://github.com/apollographql/apollo-feature-requests/issues/287)

ERROR TS6054: File '~lib/#tensorflow/tfjs-node.ts' not found

I'm trying to use AssemblyScript to build a WebAssembly inference engine for a TensorFlow.js model that I have.
I started with essentially the quickstart AssemblyScript app (which works great) and then simply added #tensorflow/tfjs to my dependencies:
$ npm install --save #tensorflow/tfjs
and added an import to assembly/index.ts:
import * as tf from "#tensorflow/tfjs";
Full code here on Github
This results in an error when I build it:
$ npm run asbuild
> test-assemblyscript#1.0.0 asbuild
> npm run asbuild:untouched && npm run asbuild:optimized
> test-assemblyscript#1.0.0 asbuild:untouched
> asc assembly/index.ts --target debug
ERROR TS6054: File '~lib/#tensorflow/tfjs.ts' not found.
import * as tf from "#tensorflow/tfjs";
~~~~~~~~~~~~~~~~~~
in assembly/index.ts(1,21)
FAILURE 1 parse error(s)
Am I misunderstanding the import syntax? I am puzzled why it would be looking in ~lib for this versus node_modules.
If you are sure the module you are trying to import is assemblyscript files, you can import with something like this ./node_modules/#tenderflow/tfjs.
I am not sure if #tensorflow has assembly files built, but I did that on assemblyscript-json for assemblyscript#0.19.8 (0.25.2 doesn't have that problem).
For example
assemblyscript-json has exported assemblyscript files from its package, so I can do this (ref)
import { JSON } from './node_modules/assemblyscript-json/assembly';
export function formatJsonString(jsonString: string): string {
const jsonObj: JSON.Obj = <JSON.Obj>JSON.parse(jsonString);
return jsonObj.stringify();
}

Module not found: Can't resoulve *.d.ts in "/file/path" in React TypeScript bootstrap with create-react-app

I'm new to TypeScript and likes to separate my type definition from my code so I created a *.d.ts file but the exported TS definition cannot be imported and use on other module file
Module not found: Can't resoulve *.d.ts in "/file/path"
would someone recommended a fix or explanation why this happen ?
The solution I found in my case is that if you import something from *.d.ts. If your file is name data.d.ts you can import it like this.
import { testA } from data.d
notice the data.d from which the name of the file that you want to import is data.d.ts

TASK: react-native-doc-viewer compileDebugJavaWithJavac FAILED

I am getting this errorr while taking android build react-native, screenshot provided below
TASK: react-native-doc-viewer compileDebugJavaWithJavac FAILED
package com.facebook.react.views.webview does not exist
https://i.stack.imgur.com/H17A8.png
The deprecated class com.facebook.react.views.webview is not actually being used. It is just a redundant import. Could be fixed by removing the import in node_modules/react-native-doc-viewer/android/src/main/java/com/reactlibrary/RNReactNativeDocViewerModule.java
Remove the ununsed import:
import com.facebook.react.views.webview.ReactWebViewManager;

Where to find locale for US in #formatjs/intl-relativetimeformat/dist/locale-data/

I'm migrating react-intl to version 3.0, and need to polyfill locale-data for IE. Specifically I want to load a polyfill of locale data for en-US. I can only find #formatjs/intl-relativetimeformat/dist/locale-data/en locale file.
if (!Intl.RelativeTimeFormat) {
// eslint-disable-next-line global-require
require('#formatjs/intl-relativetimeformat/polyfill');
// eslint-disable-next-line global-require
require('#formatjs/intl-relativetimeformat/dist/locale-data/en-US');
}
It leads to this error :
Module not found: Error: Can't resolve '#formatjs/intl-relativetimeformat/dist/locale-data/en-US' in '/xxx/xxx/xxx/xxx/app'
Try the below format in "#formatjs/intl-relativetimeformat": "^7.2.0",
import '#formatjs/intl-pluralrules/polyfill'
import '#formatjs/intl-pluralrules/locale-data/en'
import '#formatjs/intl-pluralrules/locale-data/de'
import '#formatjs/intl-relativetimeformat/polyfill'
import '#formatjs/intl-relativetimeformat/locale-data/en'
import '#formatjs/intl-relativetimeformat/locale-data/de'
and addLocaleData is no removed already as per https://formatjs.io/docs/react-intl/upgrade-guide-3x/#migrate-to-using-native-intl-apis
try to install :
npm i #formatjs/intl-relativetimeformat
I had this same exact issue, when I checked the #formatjs directory inside node_modules/ there was no dist directory #formatjs/intl-relativetimeformat/**dist/**locale-data/en so I removed it from the import and everything worked fine.

Resources