-
Notifications
You must be signed in to change notification settings - Fork 12k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Yarn PnP Support Status #16980
Comments
Another way of making Angular 9 work with Yarn 2.0 is to use Yarn team is investing into |
Some possibly relevant information regarding improving yarn 2.0 support: Replacing I noticed that @clydin authored most of the code in that file, perhaps #14841 could be fixed in the process as well. |
How does 2.1 with node_modules linker improvements impact this issue? https://dev.to/arcanis/yarn-2-1-git-workspaces-focused-installs-loose-mode-live-playground-4kfc |
With |
I'm not suggesting it would be trivial to fix this and have it automatically work the way yarn 2 works by default out of box, in addition to continuing to support NPM... but I would say this would probably go a long ways to improve developer experience. Can't wait until node_modules (at least the way it works today) is a thing of the past. |
There is ongoing work right now in You can read more and track the progress here: angular/angular#38099 |
Since the above linked issue was closed we can track the progress here https://github.com/orgs/angular/projects/2 |
Is there any specific story for that? A lot of issues getting closed with sentence 'track progress here' but no one issue in this project has specific description from closing ones. |
@JoostK I'm interested in when this linker will be available and if it'll solve yarn 2.0 pnp support? The project board appears to be mostly complete, and with |
The linker functionality is indeed functionally working, but we're not yet ready to accept published libraries in this new way (we have yet to review the API that would eventually be published to NPM, which needs special considering as it needs to be backwards/forwards compatible). Regarding pnp support, I suspect that it requires that all dependencies no longer depend on ngcc to work correctly, as otherwise you'd still need ngcc which mutates It may be possible to test this support by manually compiling all dependent libraries using the new way and then seeing if that works, but I suppose that it wouldn't tell the whole story as it wouldn't download packages from NPM, which could arguably affect how pnp works. |
Sorry but is my understanding correct, that to make pnp works it's required for all angular libs to get updated by their maintainers? |
So does this mean Angular is dead in the water as it will always require management of gigs of dependencies, long CI build times, ngcc compilation, unextendible principles coupled with the insurmountable goal of updating every existing Angular library to support pnp functionality? Or is there a streamlined plan to modernize? It seems like nobody wants to take responsibility for these topics on pnp and everybody is just delegating. |
@ld210 Try
|
Thanks, it worked, but i had to do I updated the sdks with |
Ok, i think i finally managed to get everything up and running again. What i did :
|
I think my issue is because of the angular.json file having this line: I am getting this error when trying to run |
The Have you tried |
it works!
THANK YOU |
Just did a 100% clean build running the following commands yarn with PNP worked for the default app:
|
To get IDE support for YARN PNP in VSCODE when using a monorepo setup:
add these lines to your root .vscode/settings.json file:
(./services/web/app" is the path to your apps .yarn folder) Then click allow when the popup suggests using the workspace typescript version, or manually change the typescript version when viewing a .ts file. Only downside I see to this is that your IDE will view all your apps through this apps typescript dependencies. Good luck! edit: |
I've tried to re-integrate it back, so switched to pnp, run yarn and yarn build.
|
@Lonli-Lokli, the above, should no longer be an issue in v16 which is in prerelease as NGCC has been removed. |
Thanks, I will re-check after release (https://update.angular.io/?v=15.0-16.0 do not have anything so I prefer to live without pnp one more month) |
Has anyone got this working with the latest version of Angular yet? I get is almost working by running |
Is there a way to copy assets which are included in a package (via pnp, ex: pdfjs) in the assets using the same module resolution which was implemented for styles? I can't seem to find any reference to it. I cannot copy assets from node_modules since it doesn't exist anymore. |
I'm having the same problem and after working through a ton of other issues, this appears to be the last thing blocking me from using pnp. |
What were the other issues, if you don't mind me asking? |
Some of it is what you would expect: we had The way we were running the angular cli didn't work anymore either, so we had to wrap that in a call to The strangest part was the ton of typescript compilation errors we started seeing for no apparent reason. I eventually tracked that down to the We also run After all that, yarn is much faster and it all seems to work, apart from the fact that we're missing some fonts and images that the |
I'm finally getting around to moving a library project that uses ENOTDIR: not a directory, lstat '/node_modules/@schematics/angular/collection.json/package.json'
21005 |
21006 | function makeError$1(code, message) {
> 21007 | return Object.assign(new Error(`${code}: ${message}`), { code });
| ^
21008 | }
21009 | function EBUSY(message) {
21010 | return makeError$1(`EBUSY`, message);
at makeError$1 (../../.pnp.cjs:21007:24)
at ENOTDIR (../../.pnp.cjs:21025:10)
at ZipFS.resolveFilename (../../.pnp.cjs:22607:15)
at ZipFS.realpathSync (../../.pnp.cjs:22398:28)
at ../../.pnp.cjs:23704:100
at ../../.pnp.cjs:24200:60
at ZipOpenFS.getZipSync (../../.pnp.cjs:24329:14)
at ZipOpenFS.makeCallSync (../../.pnp.cjs:24200:17)
at ZipOpenFS.realpathSync (../../.pnp.cjs:23696:17)
at VirtualFS.realpathSync (../../.pnp.cjs:23446:26)
at PosixFS.realpathSync (../../.pnp.cjs:23197:41)
at NodePathFS.realpathSync (../../.pnp.cjs:23197:41)
at maybeRealpathSync (../../.yarn/cache/resolve-patch-6d2631dc64-66cc788f13.zip/node_modules/resolve/lib/sync.js:52:16)
at resolveSync (../../.yarn/cache/resolve-patch-6d2631dc64-66cc788f13.zip/node_modules/resolve/lib/sync.js:97:25)
at NodeModulesTestEngineHost.resolve (../angular_devkit/schematics/tools/node-module-engine-host.ts:61:39)
at NodeModulesTestEngineHost.resolve (../angular_devkit/schematics/tools/node-module-engine-host.ts:68:29)
at createTestCaseSetup (schematics/test-utils.ts:117:40)
This code seems to be improperly joining the
@alan-agius4 should I open a new issue for this, or track it under this global support issue? This is the first time I've tried building/testing schematic code from within pnp. This is the code we're running within our test: const workspaceTree = await runner.runExternalSchematic(
'@schematics/angular',
'workspace',
{
name: 'workspace',
version: '7.0.0',
newProjectRoot: 'projects',
},
tree
); |
It seems that the code is trying to blindly grab that path, knowing that this case will fail and hit the catch block, since it then tries an alternative approach just after that. So, my guess is where it's checking the error type, to decide whether to absorb the error or re-throw, it needs to consider this error type too ( angular-cli/packages/angular_devkit/schematics/tools/node-module-engine-host.ts Lines 69 to 73 in c34bbb8
|
In case it helps anyone, I posted a starter project + how I set it up steps here: https://github.com/johncrim/ng16-yarn-pnp With zero install you can just "yarn start" or "F5" after git clone. I did this just because I couldn't find complete steps for starting from nothing. |
Hi there. |
Similar issue with me. I feel like this should be reported as a new bug. Would you agree? |
Absolutely, thank you ! |
As of Angular 17.0.8, I can run it with Yarn 4.0.2 PnP with the following config in
The main issue seem to be misconfigured package that forget some dependencies. |
Regarding my previous comment: it works for the older Webpack builder, but I'm now trying to move to the new esbuild builder and I get a bunch of import errors |
try to clear cache .angular, when change pnp\node-modules for me it helps |
How it is going? |
With the release of Yarn 2.0, many users may be interested in trying out the new version of the package manager with the Angular CLI. As of 9.0, the Angular CLI does not natively support Yarn 2.0 and its new package management strategy named Plug’n’Play (PnP). However, native support is currently and actively being investigated with several initial steps already in place. Native support is tentatively scheduled for inclusion in 10.0 or beyond with the goal of integrating new major versions of upstream dependencies that provide native support.
For those that are interested in experimenting with building applications using the new package manager, you can use the following instructions to workaround the current issues.
WARNING: This is not recommended for use with deployed applications and should not be used in a production environment.
pnpify
package:yarn add -D @yarnpkg/pnpify
yarn unplug <package_name>
. This should include at a minimum all@angular
scoped packages.webdriver-manager
package also needs to be unplugged:yarn unplug webdriver-manager
Once these steps are complete, Angular CLI operations such as serve or build can be used by executing
yarn pnpify ng build
oryarn pnpify ng serve
, respectively.Please note that manually running the
ngcc
command with or without the pnpify utility does not currently work.If any issues are encountered using the workaround steps or for Yarn 2.0 in general, please open a separate issue detailing the problem.
The text was updated successfully, but these errors were encountered: