Emulator error that shows unexpected token and no stack - javascript

[
I am getting the error in emulator when i run my project by cloning from github. its shows like unexpected token and no stack..

I was also getting the same error!
I search a lot but did not find any satisficed answer At last I delated yarn.Lock
and then restart the project.
It work for me enter image description here
I think the answer I too late. But it will help some other

Related

SyntaxError: Unexpected token '||='

I need to build nextjs project with PDFViewer using #react-pdf-viewer, but when collecting page there are some error SyntaxError: Unexpected token '||='.
The problem is occured from pdf.js in node_modules, I try to change ||= to || in pdf.js, and build no error.
But I need to deploy in hosting and need to download pdf.js from yarn install, some code that I change before will be restored.
How can I solve it?
This is great example how to correctly setup react-pdf with NextJS.
However, as mentioned in comments, you still get SyntaxError: Unexpected token '||=' with a node version below 15, so you need to upgrade to >=15.0.
Then it works as expected.

MongodDB "uncaught exception: SyntaxError: illegal character : #(shell):1:19"

MongoDB v4.4
GitBash v2.31.1
Windows10
First of all, i'm running my mongo shell through Git Bash.
I'm just starting to learn mongodb.
Ok, now adressing the problem.
After running mongod in the background, i run mongo on another terminal.
So, commands like "show dbs","use database" works fine but when i try to "db.database.insertOne( {property: "exampletext"})" into a collection. It returns me with the given error i.e. uncaught exception: SyntaxError: illegal character :
#(shell):1:19
BUT!!!! get this,
If i do the exact same thing on my mongo terminal located at c:\programfiles\mongodb\server\4.4\bin\mongo.exe
I have not a clue as to what is happening and can't seem to find an answer anywhere. I'm very new to the tech world so getting very technical might make me crazy. Help would be appreciated. And also knowledge as to why it's not working would be nice.

SyntaxError: Unexpected token in JSON at position 0 in meteor

I am getting an error when running meteor.js. This is the following error:
PS C:\Users\ketan\Documents\Meteor> meteor run
C:\Users\ketan\AppData\Local\.meteor\packages\meteor-tool\2.1.1\mt-os.windows.x86_64\dev_bundle\lib\node_modules\meteor-promise\promise_server.js:218
throw error;
^
SyntaxError: Unexpected token in JSON at position 0
at JSON.parse (<anonymous>)
at ProjectContext._readResolverResultCache (C:\tools\project-context.js:605:16)
at ProjectContext.reset (C:\tools\project-context.js:245:10)
at new ProjectContext (C:\tools\project-context.js:60:8)
at Command.doRunCommand [as func] (C:\tools\cli\commands.js:356:24)
at C:\tools\cli\main.js:1528:15
I can't understand the error. Please tell me the solution for this.
Note: My laptop shut down in the previous session of the meteor.
The Solution
How I ultimately ended up fixing this was just by re-cloning the repository I was working on from GitHub - after this, my application ran fine.
NOTE: I've edited this answer because I originally thought Jankaput's answer worked for me, but after digging a little further I found that it didn't.
More Info
I ran into the same problem after a shutdown while a previous Meteor process was running.
For me, running meteor reset and re-installing node_modules seemed to prevent the mentioned error from happening, but when I ran the application, I noticed odd behavior from several different sections of the application (i.e. certain packages wouldn't work, some methods that normally run fine on startup threw errors, etc.)
This makes me think that some sort of project setting was corrupted due to the meteor server I was running ending abnormally when I force shut down my computer. I'm not sure why whatever setting was corrupted managed to stay that way across a meteor reset (since meteor --help specifies that it 'Resets the project state'), but the fact that a re-cloning work makes me think that it did.
Due to the fact that it seems like running meteor reset could allow some corrupted project settings to fly under the radar after this issue pops up, I personally feel that it's probably just best to re-clone your project if this happens to you, just to be sure that nothing about the project is corrupted.
This appears to me that you have a syntax error in a JSON file that is being read by the Meteor build tool. Do you have a settings.json file in use in your project? If so, check for trailing commas or keys missing double quotes as these are the most common errors introduced to a JSON file.

Getting EISDIR error from NodeJS when attempting to start app via Expo (React Native)

I'm getting the old 'directory is not a file' error with Node, and the output does not make it clear what exactly it's trying to parse. I've tried putting logging in and everything to find the issue, and even created a brand new project but the issue persists. Can anyone shed any light on this?
Error: EISDIR: illegal operation on a directory, read
at Object.readSync (fs.js:592:3)
at tryReadSync (fs.js:366:20)
at Object.readFileSync (fs.js:403:19)
at UnableToResolveError.buildCodeFrameMessage (C:\Users\thepo\Applications\WakeMyPC\node_modules\metro\src\node-haste\DependencyGraph\ModuleResolution.js:304:17)
at new UnableToResolveError (C:\Users\thepo\Applications\WakeMyPC\node_modules\metro\src\node-haste\DependencyGraph\ModuleResolution.js:290:35)
at ModuleResolver.resolveDependency (C:\Users\thepo\Applications\WakeMyPC\node_modules\metro\src\node-haste\DependencyGraph\ModuleResolution.js:168:15)
at DependencyGraph.resolveDependency (C:\Users\thepo\Applications\WakeMyPC\node_modules\metro\src\node-haste\DependencyGraph.js:353:43)
at C:\Users\thepo\Applications\WakeMyPC\node_modules\metro\src\lib\transformHelpers.js:271:42
at C:\Users\thepo\Applications\WakeMyPC\node_modules\metro\src\Server.js:1098:37
at Generator.next (<anonymous>)
The problem turned out to be that some of the versions of modules that I installed using npm were not compatible with expo. These were indicated earlier than the error in the output for the 'expo start' command. Because these were info logs, I didn't pay enough attention to them. However, after several hours I decided to fix them and it fixed my problem.
The fix was to follow each individual package named in the output and run 'expo install '.
Make sure the entryPoint key in your app.config.js or app.json file is correctly set.
I had an intermittent error very similar to this and it was related to a bug with remote debugging.
Turning off "Debug Remote JS" in the Expo Go app shake-to-show developer menu avoided this issue for me (logs and errors still show in the Metro console).
Here's the exact error message I was getting (and sometimes the app would just fail silently without any error). It's almost identical to the error in the question with a few different line numbers (maybe from different versions).
Error: EISDIR: illegal operation on a directory, read
at Object.readSync (node:fs:721:3)
at tryReadSync (node:fs:431:20)
at Object.readFileSync (node:fs:477:19)
at UnableToResolveError.buildCodeFrameMessage
As for "why", there's some related discussion on this expo forum thread which in turn links to this React Native bug (claimed to be fixed in Expo CLI 4.13.1 but many users reporting similar issues in recent versions).
It might be related to the reported issues with Reanimated 2 and Expo's remote debugging (see this reanimated issue and the warning note in Expo's documentation) for Reanimated.

Cordova Build error: nodeValue undefined

After a couple of days without touching my app, today when I tried to build it I got the following error:
Error thrown while running shell command: "cordova build ios"
Error: Command failed: /bin/sh -c cordova build ios
Error: Cannot read property 'nodeValue' of undefined
If I remove the ios platform and add it again, it will work, but that's not the best solution... I'd like to understand the issue.
Do you have any idea what might have caused this error and what would be the best solution to fix it?
Thanks.
I just got this exact same error. For me the cause was that in my MyApp-info.plist I had added a new line that was empty, basically there was a blank key-value pair like this:
<key></key>
<string></string>
Once I removed this, the error disappeared and cordova was able to build again.
Hope that helps!

Categories