Cannot read properties of undefined (reading 'isAbsolute') - javascript

I was editing this program yesterday and it worked fine the whole time. The program is created using parcel, today when started up the script and the dev server was broken. This is the error i recived:
*Uncaught TypeError: Cannot read properties of undefined (reading 'isAbsolute')
at parcelRequire.../node_modules/tar/lib/strip-absolute-path.js.path (strip-absolute-path.js:2:9)
at newRequire (main.fb6bbcaf.js:47:24)
at localRequire (main.fb6bbcaf.js:53:14)
at parcelRequire.../node_modules/tar/lib/write-entry.js.minipass (write-entry.js:39:27)
at newRequire (main.fb6bbcaf.js:47:24)
at localRequire (main.fb6bbcaf.js:53:14)
at parcelRequire.../node_modules/tar/lib/pack.js.minipass (pack.js:28:20)
at newRequire (main.fb6bbcaf.js:47:24)
at localRequire (main.fb6bbcaf.js:53:14)
at parcelRequire.../node_modules/tar/lib/create.js../high-level-opt.js (create.js:6:14)*
I cant seem to find anyone else with the same error. This is strip-aboslute-path.js 2:9 where the error happens:
//unix absolute paths are also absolute on win32, so we use this for both
const { isAbsolute, parse } = require('path').win32
I’ve tried:
npm install, npm install tar, npm i -g npm and
changing the names of folders in the Path to the src file that included "å, ä, ö",
Would love get this running again, any suggestions on what to try next?

Solved: This probably happened due to me trying to access a variable named x and vscode auto adding "import {x} from tar" at the top of the js file. When removing the import the program was working again.

Related

amazon-ivs-web-broadcast - TypeError: Cannot read properties of undefined (reading 'bind')

Working with amazon-ivs-web-broadcast and running into the issue mentioned above when trying to create the IVSBroadcastClient
import IVSBroadcastClient from "amazon-ivs-web-broadcast";
let client = IVSBroadcastClient.create({
streamConfig: IVSBroadcastClient.BASIC_LANDSCAPE,
ingestEndpoint: streamConfigData?.stream_url,
})
Error message
Any ideas what may be causing this?
Tried passing hard coded values as arguments, and still running into the same error, so not sure what else could be causing this.
EDIT: This issue works fine on my local instance, but when it gets deployed to development, only then I am seeing the error mentioned.
I'm assuming that you are using React for this application (since I have seen this issue myself with React). If so, for now, you'll have to produce your production build with the following command:
npm run build -- --profile
To workaround an issue with the way function names are minified.

Run https://github.com/akella/webgl-mouseover-effects code locally

I want to implement image hover effect like on this website https://miew.pt/, and the closest example I got or came across can be found here https://github.com/akella/webgl-mouseover-effects
I have downloaded and extracted the files but when I run/open e.g step3.html, I am getting errors.
I have run yarn add but still getting same error as in point 1.
The error in point 1 & 2 is "Uncaught SyntaxError: Cannot use import statement outside a module"
What's the correct way to set up the code locally(Win 10)?
I just used:
npm install
npm run parcel -- step3.html
and it worked on my setup (Win 10 + NPM 6.14.14 + Node v14.17.5)
Can you try again with this setup ?

Svelte: Uncaught ReferenceError: exports is not defined

Background
I am trying to use dgraph-js-http in a Svelte application.
Error
The initial error I was facing was:
Uncaught ReferenceError: buffer is not defined
<anonymous> http://localhost:5000/build/bundle.js:6947
I'm including this as maybe my solution to this was not the best, and that hopefully there is a way to solve both this issue, and the current blocker issue.
However, after a trial-and-error approach (see below for the various things I've tried) I'm now stuck.
Current error
After solving the above error, I am now blocked on this error:
Uncaught ReferenceError: define is not defined
Attempts to resolve
None of the following have worked.
Add <script src="https://bundle.run/stream#0.0.2"></script> to index.html
Run npm install stream
Add import * as Stream from "stream" to the App.svelte file
Add import * as Stream from "stream" to the stores.js file
Add preferBuiltins:true to rollup.config.js
Add npm install --save-dev rollup-plugin-node-polyfills
Add preferBuiltins:false to rollup.config.js. This resolved prior errors and resulted in the new error of: Uncaught ReferenceError: define is not defined
Add npm install --save define. This, now results in the current blocker:
Uncaught ReferenceError: exports is not defined
I think you missed type: "module" attribute in package.json. Here, the type attribute represents whether the type of javascript interpreter is commonjs or babel. type: "module" indicates that you are going to use babel as the ECMA script interpreter.

process not defined when using npm react package

I am including npm react package in a script in the following way:
var react = require('react');
I am using node however when i do this and run my local node server i get the following error in the browser:
checkPropTypes.js:12 Uncaught ReferenceError: process is not defined
at Object.6../lib/ReactPropTypesSecret (checkPropTypes.js:12)
at s (_prelude.js:1)
at _prelude.js:1
at Object.8../checkPropTypes (factoryWithTypeCheckers.js:17)
at s (_prelude.js:1)
at _prelude.js:1
at Object.7../factoryWithTypeCheckers (factory.js:16)
at s (_prelude.js:1)
at _prelude.js:1
at Object.24../ReactElement (ReactPropTypes.js:16)
I'm not sure what is causing this error. I have tried to set NODE_ENV environmental variable using:
export NODE_ENV='development'
If anyone could shed any light on why i am getting this error that would be helpful.
Thanks in advance.

Error with "cake build:browser" and Uglify.js -- Cannot read property 'Array' of undefined

I just installed Uglify.js and tried to use it to rebuild CoffeeScript, but keep getting this error. This happens when I type "cake build:browser" in the CoffeeScript directory. (I want to try my hand at modifying the CoffeeScript language.)
My Uglify.js was cloned from GitHub and the symbolic link was created in .node_libraries. Uglify is installed correctly, confirmed since it runs properly in Node and through the command line. So maybe this is a CoffeeScript problem.
Help?
/Users/myuser/projects/UglifyJS/lib/process.js:475
return options.defines[name];
^
TypeError: Cannot read property 'Array' of undefined
at get_define (/Users/myuser/projects/UglifyJS/lib/process.js:475:47)
at Array.<anonymous> (/Users/myuser/projects/UglifyJS/lib/process.js:527:32)
at walk (/Users/myuser/projects/UglifyJS/lib/process.js:215:47)
at Array.<anonymous> (/Users/myuser/projects/UglifyJS/lib/process.js:164:59)
at walk (/Users/myuser/projects/UglifyJS/lib/process.js:220:36)
at Array.<anonymous> (/Users/myuser/projects/UglifyJS/lib/process.js:146:43)
at walk (/Users/myuser/projects/UglifyJS/lib/process.js:220:36)
at /Users/myuser/projects/UglifyJS/lib/process.js:1643:37
at Array._block (/Users/myuser/projects/UglifyJS/lib/process.js:81:34)
at walk (/Users/myuser/projects/UglifyJS/lib/process.js:220:36)
OK, I was able to replicate this. But why are you cloning the UglifyJS repo? If you just do npm install uglify-js to install to the local node-modules directory (with npm 1.x), everything runs fine.
Similar issue: https://github.com/mishoo/UglifyJS/issues/140

Categories

Resources