Comments (7)
The reason you are getting error Usage Error: Couldn't find the node_modules state file - running an install might help (findPackageLocation)
is because you are trying to use an old version of Yarn 1.22.15 (see your output of yarn --version
) whilst running yarn start
, however the repository is configured to use Node.js LTS v16.18.1 (hence why in .nvmrc it has lts/gallium
) and to use Yarn 3.1.1 (hence why there's a .yarn folder with .yarn/releases/yarn-3.1.1.cjs and a file called .yarnrc.yml whose contents include the line yarnPath: .yarn/releases/yarn-3.1.1.cjs
).
I got the same error when using the node:gallium-alpine pre-built Docker image since it was using Yarn v1 (1.22.19), but the contents of the .yarn folder and .yarnrc.yml file in this repository requires Yarn v3 and was causing a conflict.
I even got an error trying to use the versions used in this repository of Node.js LTS Gallium and Yarn 3.1.1, but when I upgraded to Yarn 3.3.0 it resolved the issue when running yarn start
. To do that I first had to:
Use stable Node.js 16.x (i.e. lts/gallium
)
Remove the .yarn directory,
rm -rf .yarn
Temporarily backup by renaming .yarnrc.yml since it has some extra lines of code at the top to retain and use later
mv .yarnrc.yml .yarnrc.yml.old
Run the following to create a .yarn folder with latest Yarn v3.3.0 and re-create .yarnrc.yml with Yarn v3.3.0 (with contents yarnPath: .yarn/releases/yarn-3.3.0.cjs
)
yarn policies set-version 3.3.0
Copy remainder of .yarnrc.yml.old back into .yarnrc.yml, so the file became:
nodeLinker: node-modules
plugins:
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: "@yarnpkg/plugin-interactive-tools"
yarnPath: .yarn/releases/yarn-3.3.0.cjs
Then using Node.js with LTS Gallium, I simply followed these Yarn instructions to install its Corepack and the latest Yarn 3.3.0 and also installed Git first since it used that, then after doing that I was able to run yarn start
without issue.
Alpine Linux
apk update && apk add --update git && rm -rf /var/cache/apk/*
corepack enable \
&& corepack prepare yarn@stable --activate \
&& yarn set version 3.3.0 \
&& yarn install
yarn start
Note: If you're using Ubuntu rather than Alpine Linux then you'd instead install git with apt-get update && apt-get install -y git
.
There's also an inconsistency in the Node.js version used in the repo. The CircleCI .circleci/config.yml file is using Node.js 16.14, whereas the .nvmrc file is using Node.js 16.18 (Gallium) lts/gallium
from substrate-front-end-template.
@hariaccubits I saw some errors in your yarn install
process. You might re-install it again or try to figure out what is that error.
from substrate-front-end-template.
@ltfschoen - looks like a good stack exchange question and answer about how to use this template to me, and per #245 comment for a PR to update things here, I am sure a succinct a minimal update would be very welcome :)
from substrate-front-end-template.
The reason you are getting error
Usage Error: Couldn't find the node_modules state file - running an install might help (findPackageLocation)
is because you are trying to use an old version of Yarn 1.22.15 (see your output ofyarn --version
) whilst runningyarn start
, however the repository is configured to use Node.js LTS v16.18.1 (hence why in .nvmrc it haslts/gallium
) and to use Yarn 3.1.1 (hence why there's a .yarn folder with .yarn/releases/yarn-3.1.1.cjs and a file called .yarnrc.yml whose contents include the lineyarnPath: .yarn/releases/yarn-3.1.1.cjs
).I got the same error when using the node:gallium-alpine pre-built Docker image since it was using Yarn v1 (1.22.19), but the contents of the .yarn folder and .yarnrc.yml file in this repository requires Yarn v3 and was causing a conflict.
I even got an error trying to use the versions used in this repository of Node.js LTS Gallium and Yarn 3.1.1, but when I upgraded to Yarn 3.3.0 it resolved the issue when running
yarn start
. To do that I first had to:Use stable Node.js 16.x (i.e.
lts/gallium
)Remove the .yarn directory,
rm -rf .yarn
Temporarily backup by renaming .yarnrc.yml since it has some extra lines of code at the top to retain and use later
mv .yarnrc.yml .yarnrc.yml.old
Run the following to create a .yarn folder with latest Yarn v3.3.0 and re-create .yarnrc.yml with Yarn v3.3.0 (with contents
yarnPath: .yarn/releases/yarn-3.3.0.cjs
)yarn policies set-version 3.3.0
Copy remainder of .yarnrc.yml.old back into .yarnrc.yml, so the file became:
nodeLinker: node-modules plugins: - path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs spec: "@yarnpkg/plugin-interactive-tools" yarnPath: .yarn/releases/yarn-3.3.0.cjs
Then using Node.js with LTS Gallium, I simply followed these Yarn instructions to install its Corepack and the latest Yarn 3.3.0 and also installed Git first since it used that, then after doing that I was able to run
yarn start
without issue.Alpine Linux
apk update && apk add --update git && rm -rf /var/cache/apk/* corepack enable \ && corepack prepare yarn@stable --activate \ && yarn set version 3.3.0 \ && yarn install yarn start
Note: If you're using Ubuntu rather than Alpine Linux then you'd instead install git with
apt-get update && apt-get install -y git
.There's also an inconsistency in the Node.js version used in the repo. The CircleCI .circleci/config.yml file is using Node.js 16.14, whereas the .nvmrc file is using Node.js 16.18 (Gallium)
lts/gallium
my initial post above is erroneous, please refer to this stackexchange post
from substrate-front-end-template.
Thanks for chiming in here @ltfschoen! Just going through these issues and trying to sort them out. Am I good to close this?
from substrate-front-end-template.
Maybe revert to using Yarn 1.x instead of Yarn 3.x or update the README with more precise steps on how to configure it to use Yarn 3.x so users don't encounter this issue and give up.
from substrate-front-end-template.
Related Issues (20)
- README : polkadot.js.org url's are outdated
- Styling forced from substratecontextprovider HOT 4
- Having problems encoding the address chain format HOT 1
- start fail
- Cannot find module 'worker_threads' HOT 1
- Investigate why numerous websocket connections are open HOT 1
- StorageDoubleMap Pallet Interactor second key input not present HOT 1
- BUG: Build is not happening with latest node and yarn version HOT 11
- Error of PoE: Failed to compile: ./src/TemplateModule.js: Attempted import error: 'useSubstrateState' is not exported from './substrate-lib'.
- Start the front-end template : error:0308010C:digital envelope routines::unsupported HOT 2
- Cryptokitties api arguments type mismatch Expected at least 32 bytes (256 bits), found 16 byte HOT 2
- Hosted endpoint wss://dev-node.substrate.dev mentioned in docs not working
- Update react hook in proof of existence solution branch.
- NEXT.JS Front end template HOT 1
- Full Support for Typescript HOT 1
- Unable to have optional params in Query calls HOT 2
- Should This Repository Be Archived? HOT 2
- Transfer of tokens don't work HOT 6
- Trouble Registering Events in Substrate Tutorial's Frontend Transaction: Need Assistance HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from substrate-front-end-template.