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

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.

Related

Module not found: Error: Can't resolve 'scenes/homePage' in 'C:\Users\adwai\OneDrive\Desktop\my projects\mern practice\client\src'

ERROR in ./src/App.js 6:0-39
Module not found: Error: Can't resolve 'scenes/homePage' in 'C:\Users\adwai\OneDrive\Desktop\my projects\mern practice\client\src'
Did you mean './scenes/homePage'?
Requests that should resolve in the current directory need to start with './'.
Requests that start with a name are treated as module requests and resolve within module directories (node_modules, C:\Users\adwai\OneDrive\Desktop\my projects\mern practice\client\node_modules).
If changing the source code is not an option there is also a resolve options called 'preferRelative' which tries to resolve these kind of requests in the current directory too.
I tried to change import homepage from "scenes/homepage"; to import homepage from "./scenes/homepage" but doing this only increased the errors.

Can't use local file images in Next 12

Created a new project in Next js with Next version 12.
Whenever I try to import and use an image file in the /public directory I get a build failure.
../public/images/header-logo.jpg
TypeError: fetch failed
at Object.processResponse (node:internal/deps/undici/undici:5575:34)
at node:internal/deps/undici/undici:5901:42
at node:internal/process/task_queues:140:7
at AsyncResource.runInAsyncScope (node:async_hooks:202:9)
at AsyncResource.runMicrotask (node:internal/process/task_queues:137:8)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
The image is in the public directory, I have no next.config.js file.
This error is only thrown during a build. If I import the image file no error is thrown.
If I use it as the src property in a next/image component, then the build error is thrown.
After losing 4 hours of my life, it turns out the issue was the experimental version of Node I installed.
Downgrading to version 16 fixed this issue.
Images should not be requested nor imported. To use images you should just use the path /images/header-logo.jpg
or
<Image src="/images/header-logo.jpg" width=xxx height=xxx />

"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

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

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?

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

Resources