example-storefront icon indicating copy to clipboard operation
example-storefront copied to clipboard

chore: switch to npm, upgrade to node 14

Open brent-hoover opened this issue 3 years ago • 6 comments

Signed-off-by: Brent Hoover [email protected]

Impact: breaking Type: chore

Issue

Node 12 is End-of-Life in April. Also trying to keep package managers consistent across projects so normalizing on npm.

Solution

Move everything to npm and node 14.18.1

Breaking changes

If you have build steps that rely on yarn, they may no longer work

Testing

Theoretically nothing should change

brent-hoover avatar Feb 10 '22 07:02 brent-hoover

I am on node 14.18.1 Doing npm i gives the below dependency error.

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/react
npm ERR!   react@"^16.13.0" from the root project
npm ERR!   peer react@"^16.4.1" from @reactioncommerce/[email protected]
npm ERR!   node_modules/@reactioncommerce/components-context
npm ERR!     @reactioncommerce/components-context@"~1.2.0" from the root project
npm ERR!     peer @reactioncommerce/components-context@"~1.2.0" from @reactioncommerce/[email protected]
npm ERR!     node_modules/@reactioncommerce/components
npm ERR!       @reactioncommerce/components@"~0.67.2" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer react@"~16.9.0" from @reactioncommerce/[email protected]
npm ERR! node_modules/@reactioncommerce/components
npm ERR!   @reactioncommerce/components@"~0.67.2" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR! 
npm ERR! See /Users/mohannarayana/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/mohannarayana/.npm/_logs/2022-02-10T22_20_44_382Z-debug-0.log

Further doing npm i --force the storefront shows the below on console image

MohanNarayana avatar Feb 11 '22 01:02 MohanNarayana

@MohanNarayana The build process runs 14.18 and is not seeing this error. Can you give me any more info about what about your configuration is different? Also I just did a fresh clone and npm install and did not see this issue

brent-hoover avatar Feb 11 '22 02:02 brent-hoover

@MohanNarayana Can you make sure you rm -rf node_modules and try again?

brent-hoover avatar Feb 11 '22 03:02 brent-hoover

I did a fresh clone of storefront (no npm i and no removing node_modules) and everything worked fine.

Next I did npm i which did not throw dependency errors but I got this error on storefront. image

There is a yarn.lock file that gets generated every time I restart storefront. The storefront does not load until the yarn.lock gets regenerated. When it starts eventually I see an Internal server error. The Errors are inconsistent, not able to narrow down on the repro steps.

MohanNarayana avatar Feb 11 '22 20:02 MohanNarayana

Everything works with the original yarn.lock. Deleted or regenerated one does not start storefront.

MohanNarayana avatar Feb 11 '22 21:02 MohanNarayana

@MohanNarayana I am not able to reproduce this error with a fresh clone, storefront loads fine for me except for the error with styled-components that I fixed in the other PR. Also this is not happening in CI. Npm works fine for me. Can you give me some more clearer steps to reproduce?

brent-hoover avatar Feb 18 '22 06:02 brent-hoover