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
Related
Today I got surprised by the following (you can try at node repl):
require("/tmp/bad.json")
SyntaxError: /private/tmp/bad.json: Unexpected token n in JSON at position 3
As you can see, I required (intentionally) a JSON file that contains a syntax error. However, on the error message, instead of the actual file path, which starts at '/tmp/' you can see that it has been replaced by the string /private/.
Why is this?
I'm using node v8.15.0
This has nothing to do with Node or the node version but with the operating system. In this case, I was using OSX, where /tmp is just a symbolic link to /private/tmp. Then when the error was triggered the actual path is showing.
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.
I am trying to test react-virtualized.I used download-zip files.
When I run npm start in react-virtualized-master,
it doesn't render anything with below error.
Can anyone help to fix this bug?
React Error:
Uncaught Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. Check the render method of `Application`.
at invariant (invariant.js:44)
at ReactCompositeComponentWrapper.instantiateReactComponent [as _instantiateReactComponent] (instantiateReactComponent.js:86)
at ReactCompositeComponentWrapper.performInitialMount (ReactCompositeComponent.js:388)
at ReactCompositeComponentWrapper.mountComponent (ReactCompositeComponent.js:262)
at Object.mountComponent (ReactReconciler.js:47)
at ReactCompositeComponentWrapper.performInitialMount (ReactCompositeComponent.js:397)
at ReactCompositeComponentWrapper.mountComponent (ReactCompositeComponent.js:262)
at Object.mountComponent (ReactReconciler.js:47)
at mountComponentIntoNode (ReactMount.js:105)
at ReactReconcileTransaction.perform (Transaction.js:138)
I don't know what "react-virtualized-master" is. Are you talking about the master branch of the react-virtualized git repository?
My guess from the error message you copied was that the wrong version of React was installed (< 15.3) so it's unable to resolve PureComponent. This should not be the case if you're running the react-virtualized repo though as 16.0 alpha should be used.
Probably need more information to help with this to be honest.
I'm using node-fluent-ffmpeg in my backend but I cant get it to set up correctly. I set the PATHS as it instructed:
process.env['FFMPEG_PATH'] = '/var/task/node_modules/fluent-ffmpeg/node_modules/ffmpeg';
process.env['FFPROBE_PATH'] = '/var/task/node_modules/fluent-ffmpeg/node_modules/ffprobe';
But now its throwing this error:
What does this mean? I've read that its related to the permissions of the file, but i don't understand what file its talking about.
this may help you
https://github.com/fluent-ffmpeg/node-fluent-ffmpeg/issues/372
all you have to do is : fs.chmod('777', function......
and it will work
I'm following this tutorial to understand the basics of stormpath: https://stormpath.com/blog/build-nodejs-express-stormpath-app/
I've followed exact steps but after login I get the following error
TypeError: Cannot read property 'href' of undefined at
Application.authenticateApplicationAccount [as authenticateAccount]
(C:\work\nodejs\node_modules\express-stormpath\node_modules\stormpath\lib\resource\Application.js:135:53)
at forms.loginForm.handle.success
(C:\work\nodejs\node_modules\express-stormpath\lib\controllers.js:215:43)
at C:\work\nodejs\node_modules\forms\lib\forms.js:94:63 at
C:\work\nodejs\node_modules\forms\lib\forms.js:55:21 at done
(C:\work\nodejs\node_modules\forms\node_modules\async\lib\async.js:132:19)
at
C:\work\nodejs\node_modules\forms\node_modules\async\lib\async.js:32:16
at C:\work\nodejs\node_modules\forms\lib\forms.js:52:25 at
C:\work\nodejs\node_modules\forms\lib\fields.js:58:21 at
Object.async.eachSeries
(C:\work\nodejs\node_modules\forms\node_modules\async\lib\async.js:142:20)
at Object.b.validate
(C:\work\nodejs\node_modules\forms\lib\fields.js:48:23)
What am I doing wrong?
Edit: Turns out I had access issues on my mac and some modules were not installed properly. This issue has been resolved. How do I close the thread?