Migrating from MUI v4 to v5: Can't declare module "#mui/styles/defaultTheme" - node.js

I'm attempting to follow Material-U's instructions to migrate from MUI v4 to MUI v5, but ran into the troubleshooting issue Property "palette", "spacing" does not exist on type 'DefaultTheme.'
I'm following the troubleshooting suggestions listed here, and added the following code to my theme.tsx file:
import { Theme } from '#mui/material/styles';
declare module '#mui/styles/defaultTheme' {
interface DefaultTheme extends Theme {}
}
but get the following error on the line declare module "#mui/styles/defaultTheme in theme.tsx:
Invalid module name in augmentation, module '#mui/styles/defaultTheme' cannot be found.ts(2664)
module "#mui/styles/defaultTheme"
That code snippet does not throw the same error if I include it in App.tsx, but including it in App.tsx does not silence the Property "palette","spacing" does not exist on type 'DefaultTheme error.
How can I either a) avoid the invalid module name in augmentation error in theme.tsx or b) overcome the does not exist on type DefaultTheme error in a different way?

Related

"Buffer2 is undefined" Error when using userbase-js with SvelteKit/Vite

I get this error when importing userbase-js into a svelte file. First I tried to use it via a script tag but then I got the error window is undefined when declaring let userbase = window.userbase. I thought it would probably be better anyway to use it via the npm package. But how to I fix this error?
Full error message:
Buffer2 is undefined
node_modules/safe-buffer/index.js#http://localhost:3000/node_modules/.vite/deps/userbase-js.js?v=4f8aa8dd:174:9
__require#http://localhost:3000/node_modules/.vite/deps/chunk-QOVRSCHT.js?v=4f8aa8dd:11:50
node_modules/randombytes/browser.js#http://localhost:3000/node_modules/.vite/deps/userbase-js.js?v=4f8aa8dd:230:19
__require#http://localhost:3000/node_modules/.vite/deps/chunk-QOVRSCHT.js?v=4f8aa8dd:11:50
node_modules/diffie-hellman/lib/generatePrime.js#http://localhost:3000/node_modules/.vite/deps/userbase-js.js?v=4f8aa8dd:3261:23
__require#http://localhost:3000/node_modules/.vite/deps/chunk-QOVRSCHT.js?v=4f8aa8dd:11:50
node_modules/diffie-hellman/browser.js#http://localhost:3000/node_modules/.vite/deps/userbase-js.js?v=4f8aa8dd:3543:25
__require#http://localhost:3000/node_modules/.vite/deps/chunk-QOVRSCHT.js?v=4f8aa8dd:11:50
#http://localhost:3000/node_modules/.vite/deps/userbase-js.js?v=4f8aa8dd:6155:37

error: cannot find symbol if (!"ovpn3".equals(BuildConfig.FLAVOR))

When I create vpn app I am geting this type of error plz someone help me in this
C:\Users\asus\Desktop\WorkBook\UltimateVpn\app\src\main\java\de\blinkt\openvpn\core\OpenVPNService.java:472: error: cannot find symbol
if (!"ovpn3".equals(BuildConfig.FLAVOR))
^
symbol: variable FLAVOR
location: class BuildConfig
I am facing the same problem. You are using old ics-vpn library. You can see not exist "BuildConfig.flavor" line anymore.
Libary Url : ics-openvpn/OpenVPNService.java

azure-devops-node-api - getPersonalAccessTokenHandler(tokenHandler) not working

having node v8.15 and Typescript of 3.4.3. Installed the latest version on azure-devops-node-api . imported the module to ts file .
let authHandler = azdev.getPersonalAccessTokenHandler(token);
giving me error as
[SPLoaderError.loadComponentError]:
***Failed to load component "50c18491-a471-4da6-8936-11a40cef9265" (HelloWorldWebPart).
Original error: ***Failed to load entry point from component "50c18491-a471-4da6-8936-11a40cef9265" (HelloWorldWebPart).
Original error: Error loading https://component-id.invalid/50c18491-a471-4da6-8936-11a40cef9265_0.0.1
Cannot find module "net"
***INNERERROR:
***Failed to load entry point from component "50c18491-a471-4da6-8936-11a40cef9265" (HelloWorldWebPart).
Original error: Error loading https://component-id.invalid/50c18491-a471-4da6-8936-11a40cef9265_0.0.1
Cannot find module "net"
***CALLSTACK:
Error
at SPLoaderError.SPError [as constructor] (https://localhost:4321/temp/workbench-packages/#microsoft_sp-loader/dist/sp-loader-assembly_default.js:8390:24)
at new SPLoaderError (https://localhost:4321/temp/workbench-packages/#microsoft_sp-loader/dist/sp-loader-assembly_default.js:4036:28)
at Function.ErrorBuilder.buildErrorWithVerboseLog (https://localhost:4321/temp/workbench-packages/#microsoft_sp-loader/dist/sp-loader-assembly_default.js:3789:21)
at Function.ErrorBuilder.buildLoadComponentError (https://localhost:4321/temp/workbench-packages/#microsoft_sp-loader/dist/sp-loader-assembly_default.js:3697:21)
at https://localhost:4321/temp/workbench-packages/#microsoft_sp-loader/dist/sp-loader-assembly_default.js:6275:47
The above issue may raise due to the incorrect reference in the code.
Other contributors provided a workaround to resolve this issue.
In his case,he tried to call the webpartcontext code and use the below references in the code.
1 import IWebPartContext from '#microsoft/sp-webpart-base/lib/core/IWebPartContext';
2 import SPHttpClient from '#microsoft/sp-http/lib/spHttpClient/SPHttpClient';
He added the below references by replacing the above code to resolve the issue.
1 import { IWebPartContext } from '#microsoft/sp-webpart-base';
2 import { SPHttpClient } from '#microsoft/sp-http';
You can also try this way to see if it could resolve your issue. For details,please refer to this link.
Hope this helps.

TypeScript "Could not find a declaration file" error on some Node.js versions

I'm trying to set the "noImplicitAny": true option for an existing TypeScript project. After making all the necessary code changes I'm getting the following error for one of our dependencies on Node 6 and 7:
Could not find a declaration file for module '#firebase/database'. '/home/travis/build/firebase/firebase-admin-node/node_modules/#firebase/database/dist/index.node.cjs.js' implicitly has an 'any' type.
This works fine on Node 8 (both locally and on Travis CI).
Does anybody know why this is? I can kind of understand the error, but no clue why it happens only on certain versions of Node.
Edit
Added the traceResolution option, and I do see a difference in how the dependency gets resolved between Node 7 and 8.
On Node 8:
'package.json' has 'typings' field 'dist/index.d.ts' that references '/home/travis/build/firebase/firebase-admin-node/node_modules/#firebase/database/dist/index.d.ts'.
File '/home/travis/build/firebase/firebase-admin-node/node_modules/#firebase/database/dist/index.d.ts' exist - use it as a name resolution result.
Resolving real path for '/home/travis/build/firebase/firebase-admin-node/node_modules/#firebase/database/dist/index.d.ts', result '/home/travis/build/firebase/firebase-admin-node/node_modules/#firebase/database/dist/index.d.ts'.
======== Module name '#firebase/database' was successfully resolved to '/home/travis/build/firebase/firebase-admin-node/node_modules/#firebase/database/dist/index.d.ts'. ========
On Node 7:
'package.json' has 'typings' field 'dist/index.d.ts' that references '/home/travis/build/firebase/firebase-admin-node/node_modules/#firebase/database/dist/index.d.ts'.
File '/home/travis/build/firebase/firebase-admin-node/node_modules/#firebase/database/dist/index.d.ts' does not exist.
Loading module as file / folder, candidate module location '/home/travis/build/firebase/firebase-admin-node/node_modules/#firebase/database/dist/index.d.ts', target file type 'TypeScript'.
File '/home/travis/build/firebase/firebase-admin-node/node_modules/#firebase/database/dist/index.d.ts.ts' does not exist.
...
File '/home/travis/build/firebase/firebase-admin-node/node_modules/#firebase/database/dist/index.node.cjs.js' exist - use it as a name resolution result.
Resolving real path for '/home/travis/build/firebase/firebase-admin-node/node_modules/#firebase/database/dist/index.node.cjs.js', result '/home/travis/build/firebase/firebase-admin-node/node_modules/#firebase/database/dist/index.node.cjs.js'.
======== Module name '#firebase/database' was successfully resolved to '/home/travis/build/firebase/firebase-admin-node/node_modules/#firebase/database/dist/index.node.cjs.js'. ========

Puppet referring to a module inside a module

I'm using Puppet 3.5.1 on Linux 6 machine.
I have a local module "A" that includes a sub-module "B". Such that sub-module "B" is located in "/etc/puppet/modules/A/modules/B".
I refer to sub-module "B" in my module "A" classes: (/etc/puppet/modules/A/manifest/init.pp file)
class A::one (
...
class { 'B':
val1 => 'abc',
val2 => 'abc',
}
...
)
B is then not reference any were else.
When I start up puppet master and the puppet agent, I get the following error on the agent:
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Puppet::Parser::AST::Resource failed with error ArgumentError: Could not find declared class B
What have I missed?
I saw some posts had the resolution as adding a 'include B' for the puppet agent node. If that's the solution, since this is a module inside another module, how do I refer to it?
Edit 1
I moved the sub module "B" into the main modules folder, from "/etc/puppet/modules/A/modules" to "/etc/puppet/modules". It gave the the error:
Error: Duplicate declaration: Class[B] is already declared; cannot redeclare at /etc/puppet/modules/A/manifest/init.pp
Having a modules/ subtree in a module is no valid structure as far as the autoloader is concerned. There is no semantics for submodules.
If you desperately want this particular case to work, you will have to add /etc/puppet/modules/A to your modulepath config setting.
You may wish to ask a new question and describe what you are actually trying to solve, because it seems that your code architecture is a little unclean.

Resources