TypeError: Cannot read property 'replace' of undefined - Not sure where it's originating as I don't use replace in the repo
TypeError: Cannot read property 'replace' of undefined - Not sure where it's originating as I don't use replace in the repo
当我 运行 我的 expo 项目时,我收到一个控制台警告。
TypeError: Cannot read property 'replace' of undefined
at matchFileNameOrURLFromStackTrace (/usr/local/lib/node_modules/expo-cli/src/utils/matchFileNameOrURLFromStackTrace.ts:16:42)
at logStackTrace (/usr/local/lib/node_modules/expo-cli/src/exp.ts:548:31)
at logWithLevel (/usr/local/lib/node_modules/expo-cli/src/exp.ts:590:11)
at Object.write (/usr/local/lib/node_modules/expo-cli/src/exp.ts:656:13)
我不确定这是从哪里来的,因为我只使用下面的替换,但我已经更改了它,但仍然出现错误。
const makeURL = (url: string) => {
return `${API_URL}/${url?.replace(/^\/+/, '')}`;
};
我已经找过matchFileNameOrURLFromStackTrace
,但到处都找不到它的踪迹。
任何指向正确方向的帮助将不胜感激。
干杯
问题已解决 (https://github.com/expo/expo-cli/issues/3473)。
npm i -g expo-cli
这已经解决了我的错误。
当我 运行 我的 expo 项目时,我收到一个控制台警告。
TypeError: Cannot read property 'replace' of undefined
at matchFileNameOrURLFromStackTrace (/usr/local/lib/node_modules/expo-cli/src/utils/matchFileNameOrURLFromStackTrace.ts:16:42)
at logStackTrace (/usr/local/lib/node_modules/expo-cli/src/exp.ts:548:31)
at logWithLevel (/usr/local/lib/node_modules/expo-cli/src/exp.ts:590:11)
at Object.write (/usr/local/lib/node_modules/expo-cli/src/exp.ts:656:13)
我不确定这是从哪里来的,因为我只使用下面的替换,但我已经更改了它,但仍然出现错误。
const makeURL = (url: string) => {
return `${API_URL}/${url?.replace(/^\/+/, '')}`;
};
我已经找过matchFileNameOrURLFromStackTrace
,但到处都找不到它的踪迹。
任何指向正确方向的帮助将不胜感激。
干杯
问题已解决 (https://github.com/expo/expo-cli/issues/3473)。
npm i -g expo-cli
这已经解决了我的错误。