ms
ms copied to clipboard
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
I am running this project on the win11 operating system and I get an error
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]);