Agoric / agoric-sdk

monorepo for the Agoric Javascript smart contract platform
Apache License 2.0
322 stars 202 forks source link

Add Node 14 to "engines" for all dapps #4002

Open katelynsills opened 2 years ago

katelynsills commented 2 years ago

What is the Problem Being Solved?

In our dapps, if the Node version is below 14, we get a mysterious error message:

katesills@kates-mbp dapp-card-store-2 % agoric install
(node:65896) ExperimentalWarning: The ESM module loader is experimental.
file:///Users/katesills/code/agoric-sdk/packages/marshal/src/marshal.js:6
import { Nat } from '@agoric/nat';
         ^^^
SyntaxError: The requested module '@agoric/nat' does not provide an export named 'Nat'
    at ModuleJob._instantiate (internal/modules/esm/module_job.js:92:21)
    at async ModuleJob.run (internal/modules/esm/module_job.js:107:20)
    at async Loader.import (internal/modules/esm/loader.js:176:24)

We need to improve the error message to point users to the appropriate Node version.

Description of the Design

Add

  "engines": {
    "node": ">=14.15.0"
  },

to the package.json in the root folder of the dapps.

This gives a much better error message:

error dapp-card-store@0.0.1: The engine "node" is incompatible with this module. Expected version ">=14". Got "13.12.0"
error Commands cannot run with an incompatible environment.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Security Considerations

None

Test Plan

None

List of dapps:

namangirdhar16 commented 2 years ago

@katelynsills i would like to work on this, please assign this to me.

katelynsills commented 2 years ago

Hi @namangirdhar16, consider yourself assigned (We can only officially assign people in our Github organization, so the "assignee" will remain blank. Let me know if you have any questions! I think this will require a number of different PRs in each of the different repositories (dapp-card-store, etc.)

namangirdhar16 commented 2 years ago

@katelynsills i guess i understand what needs to be done here, for the sake of confirmation i would like to ask do i just need to go in each project folder and update the package.json file with node version greater than 14?

katelynsills commented 2 years ago

Yes, that's right!

namangirdhar16 commented 2 years ago

Thanks!!

namangirdhar16 commented 2 years ago

@katelynsills in the package.json of this project, the node version is already updated to the desired one.

katelynsills commented 2 years ago

Yup, you're right. We need to make sure all of the dapps are updated, which have their own repos, like https://github.com/Agoric/dapp-fungible-faucet

namangirdhar16 commented 2 years ago

Ok got it!, but there is no such issue in these dapps repo, should i create one and then make a PR, is it possible somehow to refercence this issue in other repos or should i just go with a new one? Thanks for the quick response btw.

katelynsills commented 2 years ago

Ok got it!, but there is no such issue in these dapps repo, should i create one and then make a PR, is it possible somehow to refercence this issue in other repos or should i just go with a new one? Thanks for the quick response btw.

Just referencing this issue is fine, but I appreciate the issues and PRs that you've made! Thank you so much!

turadg commented 2 years ago

Note that our minimum Node is presently 14.17.0. When we get to this we should also update other references to the required version. https://github.com/Agoric/agoric-sdk/pull/4460#issuecomment-1030422275