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

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined #206

Open
lxy-Jason opened this issue Nov 18, 2023 · 0 comments

Comments

@lxy-Jason
Copy link

I am running this project on the win11 operating system and I get an error
image
Locate this bug

   console.log(fileName.split(sep),sep)
   let path = join(DIR, fileName.split(sep)[1]);

get the log

[ 'src/index.js' ] \

I don't know why these two separators are different.
But I test the following and it works.

import { join, sep, normalize } from 'path'; 

const normalizedFileName = normalize(fileName);
let path = join(DIR, normalizedFileName.split(sep)[1]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant