Skip to content
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

Error Plugin: oclif: could not find package.json with ... '@oclif/plugin-warn-if-update-available' #329

Closed
strophy opened this issue Dec 29, 2021 · 10 comments

Comments

@strophy
Copy link

strophy commented Dec 29, 2021

I am trying to migrate to @oclif/core for a CLI contained in a monorepo using yarn 3 as a package manager in order to try and use the oclif pack functionality to package the CLI as an installer. You can see how I modified the package.json for the CLI here - first question, do these changes look correct?

My issue is that when trying to run yarn oclif manifest inside the CLI directory, I get the following error:

(node:246644) Error Plugin: oclif: could not find package.json with {
  type: 'core',
  root: '/home/strophy/Code/dashevo/platform/.yarn/cache/oclif-npm-2.1.0-2512c27eb7-b8c1c52405.zip/node_modules/oclif',
  name: '@oclif/plugin-warn-if-update-available'
}
module: @oclif/core@1.0.10
task: loadPlugins
plugin: oclif
root: /home/strophy/Code/dashevo/platform/.yarn/cache/oclif-npm-2.1.0-2512c27eb7-b8c1c52405.zip/node_modules/oclif
See more details with DEBUG=*
(Use `node --trace-warnings ...` to show where the warning was created)

This dependency comes from "oclif": "^2.1.0" and doesn't seem to be properly resolved by yarn. I tried adding the following to .yarnrc.yml like this:

  "@oclif/core@*":
    dependencies:
      "@oclif/plugin-warn-if-update-available": ^2.0.2

and/or

  "oclif@*":
    dependencies:
      "@oclif/plugin-warn-if-update-available": ^2.0.2

But the error remains. Can anyone help identify what is going wrong here?

@peternhale
Copy link
Contributor

@strophy Thank you for moving forward with the new version of oclif/core. Looking at the PR, the changes you made to the deps around oclif seem correct.

I cloned the repo and gave the yarn oclif manifest a try, but using yarn v1, and it worked for me. I suspect that this might be due to yarn v2+. We have yet to make the upgrade, so I am at a bit of a loss when trying to follow the structure of this project.

I will try to get this project setup as described in the readme, with appropriate versions of tools installed to see if I can reproduce the error you are seeing.

@peternhale
Copy link
Contributor

peternhale commented Dec 29, 2021

@strophy I think I have things configured properly, but running into this error while running yarn setup

➤ YN0000: ┌ Resolution step
➤ YN0002: │ @dashevo/dashcore-lib@npm:0.19.28 doesn't provide eslint (p12ee0), requested by eslint-config-prettier
➤ YN0060: │ dash@workspace:packages/js-dash-sdk provides mocha (p8956b) with version 9.1.3, which doesn't satisfy what ts-mocha requests
➤ YN0000: │ Some peer dependencies are incorrectly met; run yarn explain peer-requirements <hash> for details, where <hash> is the six-letter p-prefixed code
➤ YN0000: └ Completed
➤ YN0000: ┌ Fetch step
➤ YN0000: └ Completed in 0s 610ms
➤ YN0000: ┌ Link step
➤ YN0000: │ ESM support for PnP uses the experimental loader API and is therefore experimental
➤ YN0000: └ Completed
➤ YN0000: Done with warnings in 1s 86ms
❯ @dashevo/grpc-common at packages/js-grpc-common (@dashevo/grpc-common)
❯ @dashevo/feature-flags-contract at packages/feature-flags-contract (@dashevo/feature-flags-contract)
❯ build (@dashevo/grpc-common)
[@dashevo/grpc-common::build] No changes. Skipping build...
❯ @dashevo/dapi-grpc at packages/dapi-grpc (@dashevo/dapi-grpc)
❯ build (@dashevo/dapi-grpc)
[@dashevo/dapi-grpc::build] changes:
[@dashevo/dapi-grpc::build]   + .eslintignore
[@dashevo/dapi-grpc::build]   + .eslintrc
[@dashevo/dapi-grpc::build]   + .mocharc.yml
[@dashevo/dapi-grpc::build]   + .npmignore
[@dashevo/dapi-grpc::build]   + CHANGELOG.md
[@dashevo/dapi-grpc::build]   + LICENSE
[@dashevo/dapi-grpc::build]   + README.md
[@dashevo/dapi-grpc::build]   + browser.js
[@dashevo/dapi-grpc::build]   + clients/core/v0/java/org/dash/platform/dapi/v0/CoreGrpc.java
[@dashevo/dapi-grpc::build]   + clients/core/v0/nodejs/CorePromiseClient.js
[@dashevo/dapi-grpc::build]   + clients/core/v0/nodejs/core_pbjs.js
[@dashevo/dapi-grpc::build]   + clients/core/v0/nodejs/core_protoc.js
[@dashevo/dapi-grpc::build]   + clients/core/v0/objective-c/Core.pbobjc.h
[@dashevo/dapi-grpc::build]   + clients/core/v0/objective-c/Core.pbobjc.m
[@dashevo/dapi-grpc::build]   + clients/core/v0/objective-c/Core.pbrpc.h
[@dashevo/dapi-grpc::build]   + clients/core/v0/objective-c/Core.pbrpc.m
[@dashevo/dapi-grpc::build]   + clients/core/v0/python/core_pb2.py
[@dashevo/dapi-grpc::build]   + clients/core/v0/python/core_pb2_grpc.py
[@dashevo/dapi-grpc::build]   + clients/core/v0/web/README.md
[@dashevo/dapi-grpc::build]   + clients/core/v0/web/core_grpc_web_pb.js
[@dashevo/dapi-grpc::build]   + clients/core/v0/web/core_pb.js
[@dashevo/dapi-grpc::build]   + clients/platform/v0/java/org/dash/platform/dapi/v0/PlatformGrpc.java
[@dashevo/dapi-grpc::build]   + clients/platform/v0/nodejs/PlatformPromiseClient.js
[@dashevo/dapi-grpc::build]   + clients/platform/v0/nodejs/platform_pbjs.js
[@dashevo/dapi-grpc::build]   + clients/platform/v0/nodejs/platform_protoc.js
[@dashevo/dapi-grpc::build]   + clients/platform/v0/objective-c/Platform.pbobjc.h
[@dashevo/dapi-grpc::build]   + clients/platform/v0/objective-c/Platform.pbobjc.m
[@dashevo/dapi-grpc::build]   + clients/platform/v0/objective-c/Platform.pbrpc.h
[@dashevo/dapi-grpc::build]   + clients/platform/v0/objective-c/Platform.pbrpc.m
[@dashevo/dapi-grpc::build]   + clients/platform/v0/python/platform_pb2.py
[@dashevo/dapi-grpc::build]   + clients/platform/v0/python/platform_pb2_grpc.py
[@dashevo/dapi-grpc::build]   + clients/platform/v0/web/README.md
[@dashevo/dapi-grpc::build]   + clients/platform/v0/web/platform_grpc_web_pb.js
[@dashevo/dapi-grpc::build]   + clients/platform/v0/web/platform_pb.js
[@dashevo/dapi-grpc::build]   + lib/getCoreDefinition.js
[@dashevo/dapi-grpc::build]   + lib/getPlatformDefinition.js
[@dashevo/dapi-grpc::build]   + lib/test/.eslintrc
[@dashevo/dapi-grpc::build]   + lib/test/bootstrap.js
[@dashevo/dapi-grpc::build]   + lib/utils/stripHostname.js
[@dashevo/dapi-grpc::build]   + node.js
[@dashevo/dapi-grpc::build]   + package.json
[@dashevo/dapi-grpc::build]   + protos/core/v0/core.proto
[@dashevo/dapi-grpc::build]   + protos/platform/v0/platform.proto
[@dashevo/dapi-grpc::build]   + scripts/build.sh
[@dashevo/dapi-grpc::build]   + test/.eslintrc
[@dashevo/dapi-grpc::build]   + test/unit/clients/core/v0/nodejs/CorePromiseClient.spec.js
[@dashevo/dapi-grpc::build]   + test/unit/clients/platform/v0/nodejs/PlatformPromiseClient.spec.js
[@dashevo/dapi-grpc::build]   + test/unit/getCoreDefinition.spec.js
[@dashevo/dapi-grpc::build]   + test/unit/getPlatformDefinition.spec.js
[@dashevo/dapi-grpc::build]   + test/unit/utils/stripHostname.spec.js
[@dashevo/dapi-grpc::build]   + @dashevo/grpc-common
$ yarn exec scripts/build.sh (@dashevo/dapi-grpc)
❯ build (@dashevo/feature-flags-contract)
[@dashevo/feature-flags-contract::build] changes:
[@dashevo/feature-flags-contract::build]   + @dashevo/dpp
[@dashevo/dapi-grpc::yarn] Usage Error: This plugin cannot access the package referenced via typanion which is neither a builtin, nor an exposed entry (when initializing @yarnpkg/plugin-workspace-tools, defined in <HOME>/git/platform/.yarnrc.yml)
[@dashevo/dapi-grpc::yarn] 
[@dashevo/dapi-grpc::yarn] Yarn Package Manager - 2.4.3
[@dashevo/dapi-grpc::yarn] 
[@dashevo/dapi-grpc::yarn]   $ yarn <command>
[@dashevo/dapi-grpc::yarn] 
[@dashevo/dapi-grpc::yarn] You can also print more details about any of these commands by calling them 
[@dashevo/dapi-grpc::yarn] after adding the `-h,--help` flag right after the command name.

@strophy
Copy link
Author

strophy commented Dec 29, 2021

Thanks for the quick response! I ran the following:

yarn set version classic
yarn install
yarn oclif manifest
yarn oclif pack:tarballs

After installing a few more system-level dependencies, I can now build installers! But our project is built around yarn 3 and the more complex commands like yarn setup fail when using yarn 1, although the errors look manageable (it looks like the CLI is not seeing the default values passed to it correctly). When forcing yarn set version 2.x I can reproduce the same error you saw above.

What are the plans to upgrade oclif to use yarn 2/3? It's a fascinating project and we are making increasingly heavy use of it, I'd like to help, with testing or anything else!

@peternhale
Copy link
Contributor

That's great news. I will raise the subject of yarn 2/3 with the team.

@wataruian
Copy link

Yarn 3 + PnP will really be a big help for many. Any plans on this?

@strophy
Copy link
Author

strophy commented Apr 6, 2022

Hi @peternhale any update on plans to support yarn 3? Or an outline of what work is required, so I could maybe attempt a PR? This support would allow us to release standalone binaries of our CLI :)

@pookah-net
Copy link

pookah-net commented Jun 30, 2022

I just tried updating ts-node to the latest (10.8.1 as of this), and that seems to have solved the OCLIF/Yarn 3 problems I was having. (I was running ts-node 10.2.something...)

I updated ts-node with: yarn add --dev ts-node@latest.

I got this from: https://stackoverflow.com/a/72528793

Almost forgot... I also put:

const fs = require('fs')

const pnpFile = `${__dirname}/../.pnp.cjs`
if (fs.existsSync(pnpFile)) {
  // console.log("Requiring pnpFile")
  require(pnpFile).setup()
}

at the top of the bin/dev file. That, I copied from Yarn itself.

@mdonnalley
Copy link
Contributor

We have yarn 2/3 support on our backlog. However, I cannot give a timeline at this time.

We're always open to contributions though - so anyone should feel free to attempt this work!

@strophy
Copy link
Author

strophy commented Jul 29, 2022

Hi @mdonnalley please don't close this issue, since the work has not been completed yet and myself and other people are monitoring the issue to get alerts when it is actually complete. I'm interested in contributing a PR myself, and I asked @peternhale above for an outline of the required work. Maybe you can respond to that question?

@strophy
Copy link
Author

strophy commented Oct 4, 2022

@mdonnalley is the backlog for this project publicly available somewhere? Should I open a new issue so I can continue to follow progress on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants