"Hello world" did not work on Typescript

after using instruction:

> exercism download --exercise=hello-world --track=typescript
> cd .\exercism\typescript\hello-world\
> yarn install
> yarn test

I have this error:

Type Error: Cannot read properties of undefined (reading 'D:\Code\exercism\typescript\hello-world\.pnp.cjs')
    at c4 (D:\Code\exercism\typescript\hello-world\.yarn\releases\yarn-3.6.0.cjs:390:12692)
    at a0e (D:\Code\exercism\typescript\hello-world\.yarn\releases\yarn-3.6.0.cjs:390:13173)
    at Object.mf (D:\Code\exercism\typescript\hello-world\.yarn\releases\yarn-3.6.0.cjs:390:13402)
    at D:\Code\exercism\typescript\hello-world\.yarn\releases\yarn-3.6.0.cjs:694:4611
    at Object.Ta (D:\Code\exercism\typescript\hello-world\.yarn\releases\yarn-3.6.0.cjs:390:10714)
    at wl.findPackageLocation (D:\Code\exercism\typescript\hello-world\.yarn\releases\yarn-3.6.0.cjs:694:4566)
    at D:\Code\exercism\typescript\hello-world\.yarn\releases\yarn-3.6.0.cjs:423:1264
    at Function.from (<anonymous>)
    at LB (D:\Code\exercism\typescript\hello-world\.yarn\releases\yarn-3.6.0.cjs:423:1008)
    at d9 (D:\Code\exercism\typescript\hello-world\.yarn\releases\yarn-3.6.0.cjs:423:1589)

And yarn install log me this:

➤ YN0032: │ fsevents@npm:2.3.3: Implicit dependencies on node-gyp are discouraged
➤ YN0002: │ @exercism/typescript-hello-world@workspace:. doesn't provide @babel/core (p29b02), requested by babel-jest
➤ YN0000: │ Some peer dependencies are incorrectly met; run yarn explain peer-requirements <hash> for details, where <hash> is the six-letter p-prefixed code

My system: Windows 10 (19045), NodeJS 20.9.0.

P.S. (github is amazing, autoclose issues - the best option, really ())

Is this sarcasm?

yes.
I’m a newbie who read the instructions, followed them and got an error. On first program. This platform is new to me, I’m used to reporting bugs.

Sorry for my terrible English.

Presuming you want people to take the time out of their days to help you, being sarcastic is probably not a very good strategy.

You are absolutely right. I couldn’t resist after I wrote issue on GitHub and it was immediately closed.

I apologize if my statement caused offense…

1 Like

It did cause offence. But I accept your apology :slight_smile:

Hopefully someone will now be able to help you with your Typescript! :slight_smile:

Hi there,

thanks a lot for this great tool and the great learning experience it gives to me.

I just tried to get started with the TypeScript track and also ran into this issue with Node 20:

/typescript/hello-world $ nvm use 20
Now using node v20.9.0 (npm v10.1.0)
/typescript/hello-world $ yarn test
Type Error: Cannot read properties of undefined (reading '/typescript/hello-world/.pnp.cjs')
    at ...

I can run the tests with Node 18, though. There were no error messages during yarn install with Node 20.

@iHiD I think, this topic should be moved to Category TypeScript. Can You do that?

For those getting this error, updating yarn seems to fix it:

yarn set version 3.x
yarn install

You can then run yarn test without errors.

Thanks for your answer. Maybe need add this command in instruction?

Sorry to link to this old thread, but I can’t run the Hello World exercise. Here is what I did:

exercism download --track=typescript --exercise=hello-world
cd Exercism/typescript/hello-world/
yarn init
yarn set version 3.x
yarn install

After the last command I get this error:

Usage Error: Couldn't find a script named "test".

Here is my configuration:

node -v
v21.1.0

yarn -v
3.8.1

Thank you very much!

Franco

Hello,
sorry for disturbing you. I solved the problem, whose main cause was the presence of a .yarn directory in my home folder. Moreover I had some problems with corepack. Here are the steps I did to have the project running, after having deleted the .yarn directory in my home.

exercism download --track=typescript --exercise=hello-world
cd Exercism/typescript/hello-world/
yarn set version stable
yarn add -D corepack
yarn install
yarn test

Thank you.

1 Like