Ember build error - javascript

When running ember build --environment=production everything seems to compile just fine. Putting the files inside dist/ on my server goes fine as well, but when I click a link on my page I get the following error:
vendor-ef159bc….js:11 Error while processing route: account Unexpected token < in JSON at position 0 SyntaxError: Unexpected token < in JSON at position 0
at Object.parse (native)
at ae.parseJSON (http://localhost:8000/assets/vendor-ef159bc608efff575c24c5e13c2d1218.js:3:12644)
at W (http://localhost:8000/assets/vendor-ef159bc608efff575c24c5e13c2d1218.js:1:15665)
at n (http://localhost:8000/assets/vendor-ef159bc608efff575c24c5e13c2d1218.js:3:13996)
at XMLHttpRequest.<anonymous> (http://localhost:8000/assets/vendor-ef159bc608efff575c24c5e13c2d1218.js:3:20168)`.
What did I do wrong?

I've solved similar problem recently by downgrading from jQuery 2 to jQuery 1 in bower.json, then deleting jQuery folder in bower_components, then running bower install command.

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.

Magento 2 cms backend javascript error Uncaught SyntaxError: Invalid or unexpected token

Suddenly I am having javascript error and cannot edit any cms page (cms/page/edit/page_id/45) or block. I have been trying to solve this for the past week with no success. I have also tried removing the modules that I have installed recently.
I did not touch any core files and I have updated file permissions but still get this error below in chrome console from the core static files
VM6148:68 Uncaught SyntaxError: Invalid or unexpected token
at template (template.js:79:36)
at render (template.js:140:24)
at iterate (template.js:236:33)
at Function._.each._.forEach (underscore.js:150:9)
at Object.template (template.js:206:15)
at UiClass.initConfig (class.js:89:28)
at UiClass._super (wrapper.js:106:35)
at UiClass.initConfig (abstract.js:123:18)
at UiClass.initConfig (wrapper.js:109:34)
at UiClass._super (wrapper.js:106:35)
Image showing spinner and javascript error
In my case, it was a database issue due to js injection. Patching a 3rd party extension fixed the issue.

How to fix 'TypeError: Cannot read property 'fn' of undefined" and 'Unable to require Taiko"

Trying to run gauge with taiko to automate some web testing. sudo gauge run specs throws two type errors and "Unable to require Taiko"
Taiko, nodejs, npm are installed and working fine. Gauge seems mostly fine. gauge init js worked.
I've tried moving the .spec file into different dirs, and moving taiko and nodejs around, with no difference.
To replicate, with everything necessary installed:
gauge init js
gauge run specs
Should run the .spec file created by 'init'
Actually output too long to include, but will show on request.
Errors:
1)
Unable to require module 'taiko' in /home/harry/tests/step_implementation.js
Trace: Error: Cannot find module 'taiko'
Require stack:
- /home/harry/tests/step_implementation.js
2)
const { openBrowser,write, closeBrowser, goto, press, text, focus, inputField, toRightOf } = require('taiko');
^
TypeError: Cannot destructure property `openBrowser` of 'undefined' or 'null'.
3)
new Test(step.fn, parameters, timeout).run().then(
^
TypeError: Cannot read property 'fn' of undefined
4)
[Gauge]
Connection to runner with Pid 15653 lost. The runner probably quit unexpectedly.
You should check your node_modules once. This kind of error happens when you don't have taiko in your node_modules.
When you do gauge init js it is added to your local node_modules. Something might have messed up so I guess Taiko is not in your node_modules try running
npm install --save taiko. This might solve your issue. Thanks.
Whats the file, the context, the OS>.. the reason why is because the monikier is mangled...
undefined is a result of a charset mismatch of some syymbolc IMHO...
Trace: Error: Cannot find module 'taiko' completely tells you that taiko is not installed , run npm i taiko and try again.

Uncaught SyntaxError: Unexpected token ; after deploying to heroku in application.js

I have a rails app running Materialize css and it works just fine in development.
Right after I deploy to heroku I get a Uncaught SyntaxError: Unexpected token ; in the application.js file.
The line of code reads: parentNode,;null!==i&&!t(i).is(do..and I just can't find it in my assets.
Any help is appreciated
I'm not really sure what fixed it but here's what I did.
Cleared my cached assets.
Erased avery trace of bootstrap in my app.
Precompiled again and pushed to heroku.
It works fine now

Using the Meteor.settings feature

Meteor recently added a brand new Meteor.settings object starting v0.5.4. And in an extremely annoying manner, didn't properly explain, with example, in their documentation how to setup settings.
In my app, I have a text file (in the root) called "settings.json":
{
"initURL" : "http://localhost:60326/"
}
But when I try to start the app using meteor --settings settings.json, I get the following error:
undefined:1
{
^
SyntaxError: Unexpected token 
at Object.parse (native)
at Object.exports.getSettings (C:\Program Files (x86)\Meteor\app\meteor\run.
js:537:10)
at start_server (C:\Program Files (x86)\Meteor\app\meteor\run.js:239:28)
at exports.run.restart_server (C:\Program Files (x86)\Meteor\app\meteor\run.
js:655:21)
at C:\Program Files (x86)\Meteor\app\meteor\run.js:726:9
at Socket.exports.launch_mongo (C:\Program Files (x86)\Meteor\app\lib\mongo_
runner.js:187:9)
at Socket.EventEmitter.emit (events.js:93:17)
at Pipe.onread (net.js:391:31)
Does anyone have any idea what could be wrong with my Meteor app's settings?
You have hidden characters in your settings.json, probably due to a copy-paste.
Your best bet is to delete the file and write it manually, or to get a text editor that can view all these unicode characters and remove them.

Categories