Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERROR Invalid template name #4

Open
JT-Dev-215 opened this issue May 22, 2020 · 2 comments · May be fixed by #5
Open

ERROR Invalid template name #4

JT-Dev-215 opened this issue May 22, 2020 · 2 comments · May be fixed by #5
Assignees
Labels
bug Something isn't working windows

Comments

@JT-Dev-215
Copy link

I get this error when I try to run the script for any template on a Windows environment.

trivin server -g -i
? Please choose which project template to use node-passport-jwt
ERROR Invalid template name

The error is caused by the the invalid path for templateDir in main.js line 55.

_const currentFileURL = import.meta.url;

import.meta.url gives the string 'file:///C:/...".

const templateDir = path.resolve(
new URL(currentFileURL).pathname,
'../../templates',
options.template.toLowerCase()
)

path.resolve() gives the string 'C:\C:...' causing the error. I had to remove the duplicate 'C:' to get the script to work.

@calvinqc calvinqc added the bug Something isn't working label May 22, 2020
@calvinqc
Copy link
Owner

Thanks a lot! I have added this Issue to Bug. And will create a PR for this one soon.

@calvinqc calvinqc self-assigned this May 22, 2020
@calvinqc calvinqc linked a pull request May 22, 2020 that will close this issue
@calvinqc
Copy link
Owner

@JT-Dev-215 Currently I don't have a Windows to test on and was quite busy at the moment with other projects at work to write some Mocha.js test.

I have created a PR #5 here to fix this issue and would love your help/contribution to test out this fix.

Please replace this code in main.js:

const currentFileURL = dirname(fileURLToPath(import.meta.url));
const templateDir = path.resolve(
    currentFileURL,
    '../templates',
    options.template.toLowerCase()
  );

And run this in terminal:

$ npm link
$ trivin server -g

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working windows
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants