unable to resolve external module typescript - visual-studio-2012

I'm trying to build a project, but I keep getting compiler errors which say
Unable to resolve external module and Module cannot be aliased to a non-module type.
I have header file which contains all the typing reference path, but even when I try to reference the path in the same file, it still doesn't resolve the problem.

I ran into this error when I shouldn't have due to a bug with TypeScript 1.0.0, but was able to resolve it by upgrading to 1.0.1. Try doing that. If you still get the error, it's probably a bug in your code.

Related

I have installed eslint on vite VueJS3 getting errors: The keyword 'interface' is undefined

On a project that compiled before I installed esLint I get errors.
It complains about Parsing error: The keyword 'interface' is reserved for a file that contains no such keyword. I moved the interface definitions to my common types.d.ts.
I don't know which configuration files will help you diagnose this, please ask if you know.

Babel error caused by reference to "process"

I've found myself in a strange predicament—after a recent upgrade to my local app dependencies, the application breaks whenever I make reference to the node process object. Specifically it throws the following errors:
Babel Error: Cannot find module '#babel/plugin-proposal-logical-assignment-operators'
So far, I've tried to resolve this issue with a yarn add of the missing dependency, without success. Could anyone shed light on the issue at hand, or how I might be able to resolve it?
Thanks for your consideration.
I resolved this issue by deleting node_modules and running yarn install.

Issues with changing locale in react-admin: language package "implicitly has an 'any' type"

Im trying to follow this official guide on how to do internationalization in react-admin. I install the language pack using npm install aor-language-swedish, and change from aor to ra in index.js of aor-language-swedish in order to make it work it react-admin instead of admin on REST (I have also tried the English pack whcih is natively supported in react-admin, but I get the same error described below).
I then try to do
import swedishMessages from "aor-language-swedish";
in my App.js but upon hovering the import, i get the error:
Could not find a declaration file for module 'aor-language-swedish'.
'c:/Users/ssm/Documents/Visual Studio Code/adminui/node_modules/aor-
language-swedish/index.js' implicitly has an 'any' type.
Try `npm install #types/aor-language-swedish` if it exists or add a new
declaration (.d.ts) file containing `declare module 'aor-language-
swedish';
What could be causing this error? I have looked around the internet, but to no avail.
If you're getting this error it is probably because you're using TypeScript, have you tried to run npm install --save-dev #types/aor-language-swedish ?
If this doesn't exist you will have to manually add a typing file, you can follow the following tutorial in order to do so:
https://medium.com/#chris_72272/migrating-to-typescript-write-a-declaration-file-for-a-third-party-npm-module-b1f75808ed2
It turns out that this problem was not in fact a problem. Ignoring it seems to work, and remember to change the root key in index.js of the package to ra instead of aor if you are using an older react-admin language module (like Swedish). However, it would be interesting to know why this warning is shown, as I am not using TypeScript. Might it be an extension that is causing this warning?

'node-jose' library is using 'zlib' library as a dependency which throws an error. How do I fix it and have you encountered the same problem?

I'm trying to use the node-jose library with angular7 for the use with JWEs. The library uses zlib as a dependency and it throws an error when compiling:
ERROR in ./node_modules/zlib/lib/zlib.js
Module not found: Error: Can't resolve './zlib_bindings' in '~\WebApp\node_modules\zlib\lib'
I opened the 'zlib.js' file and the contents are the following:
module.exports = require('./zlib_bindings');
The problem is that the required file doesn't exist. I inspected the rest of the library and there is no such file in the whole library.
I searched the whole internet and no one has described the same problem as I have. There are some discussions regarding the 'node-jose' library but none of those issues are related to 'zlib'.
I would be extremely thankful if only someone would say they share the same error. Thanks in advance!
I found the answer.
Angular isn't showing an error when compiling but shows an error in the browser. It's because the browser doesn't have 'node' libraries integrated so it can't start the 'zlib' library. Installing the 'zlib' library in 'node_modules' doesn't help since it's deprecated.
Using the 'browserify-zlib' library and changing the ...require('browserify-zlib') in all my dependencies has fixed the issue.
This PR will fix the issue in node-jose
https://github.com/cisco/node-jose/pull/264
This is published to npm as node-jose-browserify, https://www.npmjs.com/package/node-jose-browserify
npm i node-jose-browserify

Node.js module is looking for node-modules instead of node_modules

I have the following based on instructions from here:
const Pubgapi = require('pubg-api');
const apiInstance = new Pubgapi('api-key');
For some reason when I run it, the console says unable to resolve path but it's looking for a node-modules which I don't have. This is an API wrapper that I am trying to use by the way. What could cause it to give me this error?
I did an npm install as the instructions said and nothing else before the statements above.
Error message:
Unable to resolve ../node-modules/pubg-api" from ".//components/Main.js`: The module `../node-modules/pubg-api` could not be found"
I have checked the node_modules folder. It is indeed pubg-api, not pubg_api. Requiring pubg_api gives me this error.
This error is probably related to the HTTPS library that the library you are trying to install depends on. Node.js libraries are not compatible with react-native since it is not working on a Node.js platform.
To overcome this issue you can try to use react-native-http library, but I did not try to use it before, so I'm not sure if it's going to work or not.

Resources