microsoft / TypeScript

TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
https://www.typescriptlang.org
Apache License 2.0
101.08k stars 12.49k forks source link

[BUG?] "Cannot find module" error is back? #56616

Closed 0618 closed 11 months ago

0618 commented 11 months ago

🔎 Search Terms

"yarn typescript Cannot find module" "yarn pnp typescript Cannot find module" "yarn typescript pnp"

🕗 Version & Regression Information

4.0.2

⏯ Playground Link

No response

💻 Code

npm uninstall -g yarn
rm -rf ~/.yarn
mkdir yarn-issue
codepack enable
yarn init -2
yarn dlx @yarnpkg/sdks vscode # installed ZipFS, picked "Use Workspace Version"
yarn add @yarnpkg/pnpify -D
yarn add moment
touch index.ts

🙁 Actual behavior

// index.ts
import fs from "fs"; // Cannot find module 'fs' or its corresponding type declarations.
import React from "moment"; // Cannot find module 'moment' or its corresponding type declarations.

🙂 Expected behavior

It should be able to find the modules.

Additional information about the issue

No response

MartinJohns commented 11 months ago

You need to install @types/node and @types/moment. And consider updating, your TypeScript version is from 2020.

0618 commented 11 months ago

You need to install @types/node and @types/moment.

Tried, but don't work.

And consider updating, your TypeScript version is from 2020.

😂 sorry, I thought posted at https://github.com/yarnpkg/berry/issues

https://github.com/microsoft/TypeScript/issues/56616

RyanCavanaugh commented 11 months ago

The repro steps don't describe any invocation of TypeScript