Yarn Plug'n'Play — WebStorm cannot resolve dependencies and doesn't provide coding assistance

I've installed the new Yarn v2 which now uses Plug'n'Play by default. I've tried to create a new empty folder, running yarn init and yarn add node-fetch (for example) then, with node.js assistance enabled:

const fetch = require('node-fetch');

WebStorm says that I should install node-fetch. But it's already installed, and PnP support was announced in WebStorm 2019 (I've tried using both 2019 and 2020 EAP).

How can I tell WebStorm to get those dependencies from .pnp.js? It's kinda annoying to code with those warnings popping up.

Details:

WebStorm 2020.1 EAP
Build #WS-201.3803.72, built on January 24, 2020
WebStorm EAP User
Expiration date: February 23, 2020
Runtime version: 11.0.5+9-b674.2 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.15.2
GC: ParNew, ConcurrentMarkSweep
Memory: 990M
Cores: 4
Registry:
Non-Bundled Plugins:

macOS version 10.15.2, Yarn version 2.0.0-rc.27

0

What yarn version do you use? Yarn >= 2.0.0-rc23 is not yet supported, the fix (https://youtrack.jetbrains.com/issue/WEB-43298) will be available in next 2020.1 EAP

0
Avatar
Permanently deleted user

Sorry, I was using Yarn 2.0.0-rc.27 and I thought that issue is related to something else :) Thanks for the information!

0

I have same issue with Yarn 2.0.0-rc.29 and WS 19.3.3

0
Avatar
Permanently deleted user

Use WebStorm EAP (2020), you can download it from JetBrains Toolbox via drop-down near product install button. New versions have this issue solved.

0

Some of the packages started to work. But I still can't navigate to packages in same monorepo. Even in JS, where it used to work )

In the attached screenshot I am viewing package.json from storybook package, web-modules-test package is located in the same monorepo. Yet WS 2020.1 says it's not installed.

0

could you share a sample project the issue can be reproduced with?

0

I cannot, the repo is private... also as you see some other packages are resolved just fine, even though they have exactly the same structure.

0
"web-modules-statements@^1.0.0, web-modules-statements@workspace:statements":
version: 0.0.0-use.local
resolution: "web-modules-statements@workspace:statements"
dependencies:
numeral: 2.0.6
rimraf: 2.6.2
web-modules-build: ^1.0.0
web-modules-core: ^1.0.0
web-modules-test: ^1.0.0
peerDependencies:
web-modules-core: "*"
languageName: unknown
linkType: soft

"web-modules-test@^1.0.0, web-modules-test@workspace:test":
version: 0.0.0-use.local
resolution: "web-modules-test@workspace:test"
dependencies:
"@testing-library/jest-dom": 5.1.1
"@testing-library/react": 9.5.0
"@testing-library/react-hooks": 3.2.1
"@types/jest": 24.0.12
"@types/react": 16.8.17
"@types/react-addons-shallow-compare": 0.14.22
"@types/react-addons-test-utils": 0.14.23
"@types/react-dom": 16.0.11
cheerio: 0.22.0
enzyme: 3.10.0
enzyme-adapter-react-16: 1.15.1
react-dom: 16.8.6
react-test-renderer: 16.7.0
rimraf: 2.6.2
web-modules-build: ^1.0.0
languageName: unknown
linkType: soft

"web-modules-validator@^1.0.0, web-modules-validator@workspace:validator":
version: 0.0.0-use.local
resolution: "web-modules-validator@workspace:validator"
dependencies:
npm-run-all: 4.1.5
rimraf: 2.6.2
web-modules-build: ^1.0.0
web-modules-core: ^1.0.0
web-modules-test: ^1.0.0
languageName: unknown
linkType: soft

This is from yarn.lock. As you see there is no difference between packages, yet, statements package is visible in WS and test & validator are marked as not installed.

0

Sorry, but this information gives me no clue

0

https://github.com/kirill-konshin/web-modules-bug here you go.

Run yarn install && yarn build

You'll see that everything is successfully built, yet if you open statements/src/index.ts it won't navigate to test package. And if you view any of package.jsons you'll see that workspace packages are "not installed" — have yellow background:

0

 

 

>You'll see that everything is successfully built

yarn build fails for me:

E:\downloads\web-modules-bug>yarn install ➤ YN0000: ┌ Resolution step ➤ YN0000: └ Completed in 0.01s ➤ YN0000: ┌ Fetch step ➤ YN0013: │ typescript@patch:typescript@npm%3A3.8.3#builtin<compat/typescript>::version=3.8.3&hash=273569 can't be found in the cache and will be fetched from the disk ➤ YN0013: │ typescript@npm:3.8.3 can't be found in the cache and will be fetched from the remote registry ➤ YN0000: └ Completed in 23.84s ➤ YN0000: ┌ Link step ➤ YN0000: └ Completed in 0.05s ➤ YN0000: Done in 23.9s

E:\downloads\web-modules-bug>yarn build ➤ YN0000: src/index.ts(1,23): error TS2307: Cannot find module 'web-modules-test'. ➤ YN0000: The command failed for workspaces that are depended upon by other workspaces; can't satisfy the dependency graph ➤ YN0000: Failed with errors in 0.98s

0

Run install one more time ))) somehow it helps

dis@lmrc9220 web-modules-core-bug % yarn build
➤ YN0000: src/index.ts(1,23): error TS2307: Cannot find module 'web-modules-test'.
➤ YN0000: The command failed for workspaces that are depended upon by other workspaces; can't satisfy the dependency graph
➤ YN0000: Failed with errors in 0.97s
dis@lmrc9220 web-modules-core-bug % yarn
➤ YN0000: ┌ Resolution step
➤ YN0000: └ Completed in 0.01s
➤ YN0000: ┌ Fetch step
➤ YN0000: └ Completed in 0.06s
➤ YN0000: ┌ Link step
➤ YN0000: └ Completed in 0.05s
➤ YN0000: Done in 0.12s
dis@lmrc9220 web-modules-core-bug % yarn build
➤ YN0000: Done in 0.91s
0

请先登录再写评论。