Похожие чаты

Do you know how to fix it? if i add

/src/ in my readFile string it works but i dont want to resolve like this, why am i forced to use specify src?

I start my app with

npx ts-node-dev --respawn --transpile-only src/test.ts

18 ответов

6 просмотров

Because readFile is relative to your current working directory

Filiberto- Автор вопроса

Is this command ran after cd'ing into src?

Filiberto- Автор вопроса
Thomas
Is this command ran after cd'ing into src?

i just use it to compile my ts file

Filiberto
i just use it to compile my ts file

So your current working directory is not src

Filiberto- Автор вопроса
Thomas
So your current working directory is not src

how can i tell to ts to consider src as my working dir?

Filiberto
???

I think use process.cwd() in the readFile instead of ./

Filiberto- Автор вопроса
David
I think use process.cwd() in the readFile instead ...

can i do something wiht typescript config?

Filiberto
can i do something wiht typescript config?

I think that is completely unrelated to readFile. the tsconfig stuff is for telling the compiler where to look when it builds the ts into js

Filiberto- Автор вопроса

.

Filiberto
.

// tconfig.json { "compilerOptions": { "rootDir": "src", ... "ts-node": { "transpileOnly": true, "files": true, "compilerOptions": { "rootDir": "." } } }

Filiberto
how can i tell to ts to consider src as my working...

cd src && npx ts-node-dev --respawn --transpile-only test.ts

Filiberto- Автор вопроса
Filiberto- Автор вопроса
Thomas
cd src && npx ts-node-dev --respawn --transpile-on...

it works but i dont want to go inside src, like this

Filiberto
it works but i dont want to go inside src, like th...

That's what "current working directory" means

Filiberto- Автор вопроса
Thomas
That's what "current working directory" means

shouldn't be related to the file where Im writing the code?

Похожие вопросы

Обсуждают сегодня

Is UniBright Freequity an active live product ? A friend here in Asia was discussing the Tokenisation of RWA’s in his case Real Estate as he’s a developer with numerous overs...
Digital Trust
4
коллеги, добрый вечер! А никто не знает как модальная форма может себя закрыть? Ну допустим модальная форма определила, что смысла ей работать нет и хочет вернуть modalResult...
Михаил
83
Hi, is it fine to use git to backup my config? I did so many things that I don't want to miss if I switched to another OS, so how do you backup your home and configs? And shou...
Adnan Al_Beda
30
Добрый день задумываюсь о создание токена из за того что много свободного времени и вот я узнал что транзакции за перевод этого токена будут в waves и тут пришла идея при тран...
Артем
3
Zapper планирует свой токен. Агрегатор DeFi и трекер портфолио портфелем ценных бумаг Zapper представил протокол Zapper, целью которого является стимулирование и контекстуал...
Foxcool
3
А если изначально бот работал так : есть сайт онлайн школы. У каждого ученика свой кабинет. Где он авторизуется по своим данным. И уже в кабинете, на самом сайте делает оплату...
Денис 💡 Фрилансер
13
А что ты вообще делаешь ?
Yesgoter
13
Crypto aman premium grp koi join kiya hai... Kaisa hai service any one idea??
Arvind Sharma
16
средствами IBX как-то можно выполнить запрос insert ... returning?
Igor
31
На работе пишем распределенное приложение, у которого сотни, если не тысячи настроек. Конфиги написаны на xml, расположены на разных хостах и должны быть согласованы друг с др...
Aleksandr Druzhinin
5
Карта сайта