Closed InterwebCounty closed 7 years ago
If you remove the chordgenerator
does it works fine? If yes, then can you share the code within the chordgenerator
file?
If I remove it it works, (except it breaks in different ways because I removed it) and I get that same error on another file I require in the same way, so I don't think the bug in the 'chordgenerator' file.
The files kind of look like this:
` module.exports = { goforit:function(){ //blah blah long function
} }`
Since I posted this I updated Node and Adonis to the newest stable versions and I'm still getting the error. And like I said, I didn't touch the damn thing, it was working two days ago and now it isn't. I'm thinking it's not an Adonis error, it looks like something in the Require module, maybe something auto-updated itself, I have no clue.
Also "var async = require('async');" or similar works just fine.
What happens if you add use strict
statement on the top of the file?
Nope, no change.
Do you think it could be Adonis?
Yeah kind of weird on why require behaves this way. It happens when v8 is not able to parse the file and the errors are not helpful.
Nope I don't think Adonis has anything to do with it, since it is a normal require
call.
All I can suggest is to make sure you are not making use of Es6 generators
with arrow functions.
* someFunction = () => {
}
* someFunction = function () {
}
I have something else wrong, I made a "hello world" file and included it in the same way and it didn't break.
Thanks for your help though, I'll probably throw you some cash through Patreon.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Hi, this is strange and I'm not sure if it's an Adonis issue - but suddenly after not touching my app for a couple of days it's giving me an error when I require a script like so:
var chordgenerator = require("./chordgenerator");
This is in a controller, there is a "chordgenerator.js" file in Http/Controllers
the error is:
` SyntaxError: Invalid regular expression: missing /
I haven't touched it or updated anything - I'm stumped.