jimmychu0807 / substrate-front-end-template

A Polkadot.js API + React based template for building Substrate Front Ends
The Unlicense
315 stars 352 forks source link

yarn install fails on m1 #213

Closed atylee29 closed 2 years ago

atylee29 commented 2 years ago

Environment:

Steps to reproduce:

git clone https://github.com/substrate-developer-hub/substrate-front-end-template
cd substrate-front-end-template
yarn install

Result: I get errors for many dependencies, in this form:

...
➤ YN0013: │ @babel/plugin-syntax-optional-chaining@npm:7.8.3 can't be found in the cache and will be fetched from the remote registr
➤ YN0001: │ Error [ERR_STREAM_PREMATURE_CLOSE]: Premature close
    at new NodeError (node:internal/errors:371:5)
    at PassThrough.onclose (node:internal/streams/end-of-stream:122:30)
    at PassThrough.emit (node:events:390:28)
    at emitCloseNT (node:internal/streams/destroy:145:10)
    at processTicksAndRejections (node:internal/process/task_queues:82:21)
➤ YN0013: │ @babel/plugin-syntax-private-property-in-object@npm:7.14.5 can't be found in the cache and will be fetched from the remo
➤ YN0001: │ Error [ERR_STREAM_PREMATURE_CLOSE]: Premature close
    at new NodeError (node:internal/errors:371:5)
    at PassThrough.onclose (node:internal/streams/end-of-stream:122:30)
    at PassThrough.emit (node:events:390:28)
    at emitCloseNT (node:internal/streams/destroy:145:10)
    at processTicksAndRejections (node:internal/process/task_queues:82:21)
➤ YN0013: │ @babel/plugin-syntax-top-level-await@npm:7.14.5 can't be found in the cache and will be fetched from the remote registry
➤ YN0001: │ Error [ERR_STREAM_PREMATURE_CLOSE]: Premature close
    at new NodeError (node:internal/errors:371:5)
    at PassThrough.onclose (node:internal/streams/end-of-stream:122:30)
    at PassThrough.emit (node:events:390:28)
    at emitCloseNT (node:internal/streams/destroy:145:10)
    at processTicksAndRejections (node:internal/process/task_queues:82:21)
...

I suspect it is not related to my terminal/node/yarn because said applications work fine for my other work in react-native. Errors are not limited to babel dependencies, but also most others, including @ledgerhq, @jest, @hapi...

yarn install --verbose returns Unknown Syntax Error: Unsupported option name ("--verbose"). although it does not do this with my React Native app. And there are no error logs in my project root directory.

Wondering if anyone has encountered this and have suggestions for a fix? For now, npm install and npm start work without issue.

proleet commented 2 years ago

Dealing with the same issue right now. :(

branch v3.0.0 seems to work.

sharp commented 2 years ago

same issue. node v16 seems to work.

cor commented 2 years ago

Same issue here. Here's how to downgrade to node v16 if you're using homebrew:

brew install node@16
brew unlink node
brew link --overwrite node@16
node --version  # should be v16.13.1

(source)

After that, running yarn install in substrate-front-end-template/ should work.

r-medina commented 2 years ago

can verify that this doesn't work on older macbooks as well

this comment shows a workaround

running

yarn set version latest
yarn install

gives you a working install

not sure which branch to commit to to make the changes visible to the latest tag, but i'm sure someone can push that up quickly if that's an acceptable workaround

codernineteen commented 2 years ago

This doesn't work on WSL2 either when i had latest Node.js LTS version 17.+ But it works on version lts/gallium

jinuhwang commented 2 years ago

On M1, was able to solve the problem by checking out latest (aa7c4de at the moment). node version: v16.13.2

git clean -fdx
yarn install
yarn start
superabhinav commented 2 years ago

on mac m1 i get same errors when I follow docs and do `cd substrate-front-end-template

We want to use the latest tag throughout all of this tutorial

git checkout latest` -- this line causes error

I suspect the latest branch is missing package.json file

superabhinav commented 2 years ago

on mac m1 i get same errors when I follow docs and do cd substrate-front-end-template git checkout latest -- this line causes error

I suspect the latest branch is missing package.json file

sousvideonlow commented 2 years ago

Encountered the issue but using node version 16 didn't resolve it

Posted here - on stackoverflow

jimmychu0807 commented 2 years ago

The frontend template is tested on node v16 (the current lts version) and not tested on v17 (as shown in the .circleci/config.yml file.

If node v17 is already installed, you could use nvm to install and manage multiple node versions in your machine.

sideshowbarker commented 9 months ago

Setting YARN_CHECKSUM_BEHAVIOR=update in the environment is the only thing that worked for me.

That is, either doing export YARN_CHECKSUM_BEHAVIOR=update or else running YARN_CHECKSUM_BEHAVIOR=update yarn as the command, instead of just yarn.

(from https://stackoverflow.com/a/71276936/441757, as linked to in https://github.com/substrate-developer-hub/substrate-front-end-template/issues/213#issuecomment-1051812768 above)