TypeError: value.replace is not a function

Hi, I'm trying to run my bot on pterodactyl (docker) nodejs 21. I'm getting the error TypeError: value.replace is not a function anyone any ideas? Full error
/usr/local/lib/node_modules/ts-node/dist/util.js:62
return value.replace(backslashRegExp, directorySeparator);
^
TypeError: value.replace is not a function
at normalizeSlashes (/usr/local/lib/node_modules/ts-node/dist/util.js:62:18)
at Object.getExtendsConfigPath (/usr/local/lib/node_modules/ts-node/dist/ts-internals.js:24:54)
at readConfig (/usr/local/lib/node_modules/ts-node/dist/configuration.js:127:64)
at findAndReadConfig (/usr/local/lib/node_modules/ts-node/dist/configuration.js:50:84)
at phase3 (/usr/local/lib/node_modules/ts-node/dist/bin.js:254:67)
at bootstrap (/usr/local/lib/node_modules/ts-node/dist/bin.js:47:30)
at Object.<anonymous> (/usr/local/lib/node_modules/ts-node/dist/child/child-entrypoint.js:23:21)
at Module._compile (node:internal/modules/cjs/loader:1368:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1426:10)
at Module.load (node:internal/modules/cjs/loader:1205:32)
Node.js v21.7.3
/usr/local/lib/node_modules/ts-node/dist/util.js:62
return value.replace(backslashRegExp, directorySeparator);
^
TypeError: value.replace is not a function
at normalizeSlashes (/usr/local/lib/node_modules/ts-node/dist/util.js:62:18)
at Object.getExtendsConfigPath (/usr/local/lib/node_modules/ts-node/dist/ts-internals.js:24:54)
at readConfig (/usr/local/lib/node_modules/ts-node/dist/configuration.js:127:64)
at findAndReadConfig (/usr/local/lib/node_modules/ts-node/dist/configuration.js:50:84)
at phase3 (/usr/local/lib/node_modules/ts-node/dist/bin.js:254:67)
at bootstrap (/usr/local/lib/node_modules/ts-node/dist/bin.js:47:30)
at Object.<anonymous> (/usr/local/lib/node_modules/ts-node/dist/child/child-entrypoint.js:23:21)
at Module._compile (node:internal/modules/cjs/loader:1368:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1426:10)
at Module.load (node:internal/modules/cjs/loader:1205:32)
Node.js v21.7.3
Start command:
:/home/container$ if [[ -d .git ]] && [[ ${AUTO_UPDATE} == "1" ]]; then git pull; fi; if [[ ! -z ${NODE_PACKAGES} ]]; then /usr/local/bin/npm install ${NODE_PACKAGES}; fi; if [[ ! -z ${UNNODE_PACKAGES} ]]; then /usr/local/bin/npm uninstall ${UNNODE_PACKAGES}; fi; if [ -f /home/container/package.json ]; then /usr/local/bin/npm install; fi; if [[ "${MAIN_FILE}" == "*.js" ]]; then /usr/local/bin/node "/home/container/${MAIN_FILE}" ${NODE_ARGS}; else /usr/local/bin/ts-node --esm "/home/container/${MAIN_FILE}" ${NODE_ARGS}; fi
:/home/container$ if [[ -d .git ]] && [[ ${AUTO_UPDATE} == "1" ]]; then git pull; fi; if [[ ! -z ${NODE_PACKAGES} ]]; then /usr/local/bin/npm install ${NODE_PACKAGES}; fi; if [[ ! -z ${UNNODE_PACKAGES} ]]; then /usr/local/bin/npm uninstall ${UNNODE_PACKAGES}; fi; if [ -f /home/container/package.json ]; then /usr/local/bin/npm install; fi; if [[ "${MAIN_FILE}" == "*.js" ]]; then /usr/local/bin/node "/home/container/${MAIN_FILE}" ${NODE_ARGS}; else /usr/local/bin/ts-node --esm "/home/container/${MAIN_FILE}" ${NODE_ARGS}; fi
Both ts and js have been tried. Thanks!
4 Replies
Amgelo
Amgelo5mo ago
GitHub
[Typescript 5.0] TypeError: value.replace is not a function · Issu...
Search Terms Typescript 5.0 tsconfig extends array Expected Behavior No error. Actual Behavior $ npm exec -- ts-node --esm --swc ./path/to/reproduce.mts /path/to/node_modules/ts-node/dist/util.js:6...
GamingTwist
GamingTwistOP5mo ago
What part? I have tried the packages that were suggested with no luck. I couldn't work out how to change the extends part. It seems this is the trouble https://github.com/TypeStrong/ts-node/issues/2000#issuecomment-1630229384 "extends": ["@sapphire/ts-config", "@sapphire/ts-config/extra-strict", "@sapphire/ts-config/decorators"], honestly this might be just a case of moving off ts-node. I dont see a update for it in 2 years. This was just what the default used. Tho I dont know why JS isnt working when I move it from my pc Must have overwrote something... Its working now. I'm going to try replace ts-node still tho. Is there a recommended one for this project?
Favna
Favna5mo ago
Node 21 has been EOL for a while now. Update to Node 22 or 24
Favna
Favna5mo ago
GitHub
GitHub - nodejs/Release: Node.js Release Working Group
Node.js Release Working Group. Contribute to nodejs/Release development by creating an account on GitHub.

Did you find this page helpful?