Open 0xpatrickdev opened 3 months ago
I suspect the solve here is adding a .yarnrc.yml
with nodeLinker: node-modules
, but am unsure how to test this locally. (I am familiar with yarn link
but not for something like yarn create
, where a project/package.json doesn't yet exist).
I also suspect we will need to tell CI (which currently uses yarn 1.22.x) to run this with yarn 4.x, and also add a test like:
diff --git a/packages/create-dapp/test/sanity.test.js b/packages/create-dapp/test/sanity.test.js
index f4424d587..4e6395a68 100644
--- a/packages/create-dapp/test/sanity.test.js
+++ b/packages/create-dapp/test/sanity.test.js
@@ -15,4 +15,5 @@ test('sanity', async t => {
t.is(await myMain(['--help']), 0, '--help exits zero');
t.is(await myMain(['--version']), 0, '--version exits zero');
t.is(await myMain(['--zorgar']), 1, 'unknown flag fails');
+ t.is(await myMain(['demo']), 0, 'create-dapp demo exits 0');
});
Note: https://github.com/Agoric/agoric-sdk/issues/451 is a potential solution, but probably the one with the longest lead time. It seems like we have two interim solutions, the second of which might close this issue:
Document that developers should use yarn 1.22.x
in Getting Started. See https://github.com/Agoric/documentation/issues/1174
dapp-agoric-basics
uses yarn 1.22.x at the time of writing, while dapp-agoric-basics
seems to be using yarn 4.x. I'm not sure how this will affect things, but something to keep in mindAdd a .yarnrc.yml
with nodeLinker: node-modules
to /packages/create-dapp
, as mentioned above
but am unsure how to test this locally.
I am currently using verdaccio to proxy a private locally-hosted registry and overriding the npmRegistryServer
with it to actually pull packages from it.
So just adding a .yarnrc.yml
with nodeLinker: node-modules
didn't work. I believe yarn4 has pnp globally enabled - so I tried to switch it to use node-modules
explicitly (can use either yarn config set nodeLinker node-modules
or put it in a .yarnrc.yml
in the directory you are gonna run yarn create @agoric/dapp demo
.
It got rid of the pnp error but it threw the following:
node:internal/errors:496
ErrorCaptureStackTrace(err);
^
Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/private/var/folders/5n/lpny95rx2mz3jwpr6vbbsvg80000gn/T/xfs-93f97866/dlx-84923/node_modules/@agoric/vats/tools/board-utils.js' imported from /private/var/folders/5n/lpny95rx2mz3jwpr6vbbsvg80000gn/T/xfs-93f97866/dlx-84923/node_modules/agoric/src/lib/format.js
at new NodeError (node:internal/errors:405:5)
at finalizeResolution (node:internal/modules/esm/resolve:327:11)
at moduleResolve (node:internal/modules/esm/resolve:980:10)
at defaultResolve (node:internal/modules/esm/resolve:1193:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:404:12)
at ModuleLoader.resolve (node:internal/modules/esm/loader:373:25)
at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:250:38)
at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:76:39)
at link (node:internal/modules/esm/module_job:75:36) {
url: 'file:///private/var/folders/5n/lpny95rx2mz3jwpr6vbbsvg80000gn/T/xfs-93f97866/dlx-84923/node_modules/@agoric/vats/tools/board-utils.js',
code: 'ERR_MODULE_NOT_FOUND'
}
This^ was resolved by bumping agoric dependency to ^0.22.0-u16.2
in packages/create-dapp/package.json
.
I believe the user triggering yarn create
has to set their nodeLinker
to node-modules
using either of the two ways i mentioned above, and then run the yarn create
command to be able to install the package and run the dapp successfully.
What do you think/suggest @0xpatrickdev ? With this^, we would need to update the docs accordingly as well to mention those steps.
@mujahidkay thanks for the great analysis here. I responded in the PR
It got rid of the pnp error but it threw the following:
I cannot reproduce this error, for me after setting the linker, it inits the dapp correctly
➤ YN0085: │ + @agoric/create-dapp@npm:0.1.1-u16.2, @agoric/access-token@npm:0.4.22-upgrade-16a-dev-fb592e4.0, @agoric/assert@npm:0.6.1-upgrade-16a-dev-fb592e4.0, and 423 more.
The fact that we ended up resolving to upgrade-16a-dev
packages is not good, we need to revisit how we generate pre-release tags for dev branches.
It got rid of the pnp error but it threw the following:
I cannot reproduce this error, for me after setting the linker, it inits the dapp correctly
➤ YN0085: │ + @agoric/create-dapp@npm:0.1.1-u16.2, @agoric/access-token@npm:0.4.22-upgrade-16a-dev-fb592e4.0, @agoric/assert@npm:0.6.1-upgrade-16a-dev-fb592e4.0, and 423 more.
The fact that we ended up resolving to
upgrade-16a-dev
packages is not good, we need to revisit how we generate pre-release tags for dev branches.
Thanks @mhofman for the insights! I think I understand what happened here. For me, it was pulling @agoric/create-dapp@npm:0.1.0
which resulted in the above error. Now, I'm assuming this shouldn't ever happen with npm registry and could have been due to a misconfigured localhost environment.
Do you know why the agoric-sdk/packages/create-dapp/package.json
still points to 0.1.0
(different from what's on npm)?
Do you know why the
agoric-sdk/packages/create-dapp/package.json
still points to0.1.0
(different from what's on npm)?
Our release process currently does not have a well defined way to merge back the changes of the release branch into master, which means that we've not been able to incorporate the version and generated changelog changes of releases back into trunk.
It is partially blocked technically on https://github.com/Agoric/agoric-sdk/issues/9490, but we do need a process in place anyway.
Describe the bug
yarn create @agoric/dapp demo
fails with yarn 4. The error message suggests it might be due to Plug'n'Play (the defaultnodeLinker
setting).To Reproduce
Steps to reproduce the behavior:
yarn -v 4.3.1
/private/var/folders/tz/jycbd2h54t39vpjnypzwktc80000gn/T/xfs-8f80eeba/dlx-25296/.pnp.cjs:10434 Error.captureStackTrace(firstError); ^
Error: @agoric/create-dapp tried to access .bin, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.
Required package: .bin (via ".bin/agoric") Required by: @agoric/create-dapp@npm:0.1.1-u16.2 (via /private/var/folders/tz/jycbd2h54t39vpjnypzwktc80000gn/T/xfs-8f80eeba/dlx-25296/.yarn/cache/@agoric-create-dapp-npm-0.1.1-u16.2-4cdbbfdecb-a5578b9b12.zip/node_modules/@agoric/create-dapp/src/)
Require stack:
Node.js v18.18.2