After I modified the file in my self-defined packages, an error occured


#1

Hi, guys!
I have a self-defined package in the meteor app, but after I modified some files in this package, an error occured:
the methods is existing!
How can I do now?


#2

Hi, could you post your code and errors? I can’t help without it.


#3

Exception in callback of async function: Error: Cannot add a route at an existing path:


#4

Can you post the full stack trace and the code around the location of the error?
You’re not providing enough information for anyone to help


#5

Ok, thanks first to megaman and coagmano!
The problem is very complex, and I am sure it’s not about the code.
I need time to clear up the whole thing. Thanks!


#6

The problem it’s the .svn directory.
After I removed it, all errors disappeared.:sweat_smile:


#7

Weird, Meteor is supposed to ignore folders starting with a .
Was this a .svn folder inside the package?
How were package files included in the package.js file?


#8

Hi, @coagmano, I think it’s odd too, so let me tell you the whole story:

  1. I get the app source code from my subversion server by “svn co”, and use “svn update” to keep it fresh;
  2. the .svn folder is in the app root directory of course;
  3. I got the “(svn)conflict” problem many times but all resolved;
  4. This is my package’s core file:
    Meteor.methods({
    myteamJoin({ cid }) {
    if (!this.userId) {
    throw new Meteor.Error(‘error-invalid-user’, ‘Invalid user’, { method: ‘myteamJoin’ });
    }
    …}
    });
    (nimble:restivus)MYAPI.v1.addRoute(‘myteam.update/:id’, { authRequired: false }, {

    });
  5. In previous times the app can be compiled and executed, but after I modified and “svn ci/update” the code many times, the error “method or route exists” ocurred and I’m sure there are no duplicate code snippet or files.
  6. So I decided to delete somethings like the .svn folder, I typed this command:
    find . -type d -name ".svn"|xargs rm -rf
    And like I told you before, all errors disappeared.:sweat:

#9

I think this might be an actual meteor tool bug, if it’s potentially including files from the .svn directory.
I’d create an issue on the github: https://github.com/meteor/meteor/issues

I tried searching for the string "method or route exists" in meteor and restivus’ sources and couldn’t find it in either.
What packages are you using and which versions?


#10

The exact error message is: “Cannot add a route at an existing path”
And the nimble:restivus version is: 0.8.12


#11

Yeah okay, so it’s being thrown here:

I’m unsure if this makes sense for svn but I suspect an older version of the same file is being loaded from that folder, and making restivus upset that both files are trying to register the same path

Can you test somehow if files in the .svn folder are being loaded? Maybe just add an obvious console.log?


#12

Hi, @coagmano.
restivus throwed ‘the route exists’,
and meteor(v1.8.0.2) throwed ‘the method exists’.
It looks like there are duplicated files in the .svn?
Let me do a test after my works be finished.:smile: