The error shown when yarn start command is given
Error details:
Internal Error: confusion@workspace:.: This package doesn't seem to be present in your lockfile; try to make an install to update your resolutions
at J.getCandidates (C:\Users\risha\Desktop\Front-End Web Development with React\.yarn\releases\yarn-berry.js:2:276872)
at i.getCandidates (C:\Users\risha\Desktop\Front-End Web Development with React\.yarn\releases\yarn-berry.js:2:266282)
at C:\Users\risha\Desktop\Front-End Web Development with React\.yarn\releases\yarn-berry.js:2:286432 at C:\Users\risha\Desktop\Front-End Web Development with React\.yarn\releases\yarn-berry.js:57:349928
at new Promise (<anonymous>)
at e.exports (C:\Users\risha\Desktop\Front-End Web Development with React\.yarn\releases\yarn-berry.js:57:349910)
at o (C:\Users\risha\Desktop\Front-End Web Development with React\.yarn\releases\yarn-berry.js:57:349611)
at C:\Users\risha\Desktop\Front-End Web Development with React\.yarn\releases\yarn-berry.js:57:349684
at C:\Users\risha\Desktop\Front-End Web Development with React\.yarn\releases\yarn-berry.js:57:349727
at new Promise (<anonymous>)
My package.json file is
{
"name": "confusion",
"version": "0.1.0",
"private": true,
"dependencies": {
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-scripts": "3.4.1"
}
}
I have tried adding
"scripts":{
"start":"react-scripts start"
}
But no change in the error.
Step 1 — Installing Yarn Globally The Yarn maintainers recommend installing Yarn globally by using the NPM package manager, which is included by default with all Node. js installations. Use the -g flag with npm install to do this: sudo npm install -g yarn.
To solve the error "yarn: command not found", install the yarn package globally by running npm install -g yarn and restart your terminal. If the command fails, run it with sudo and make sure the correct PATH is set in your system's environment variable.
resolutions is simply a map of package names and the exact versions of those packages that should be kept in the dependency tree, i.e. the above configuration will remove all versions of webpack that are not 5.6.
Install all the dependencies listed within package. json in the local node_modules folder.
Cross-posting from this question:
The problem in here seems to be an existing yarn.lock
file inside of one of the workspaces. Deleting it solves the problem.
Example: 3 workspaces: 2 create-react-app (app
, home
) and one shared component: (components
)
Inside the component
folder a lingering yarn.lock
file exists. Remove it.
Also check that:
"private:true"
in each of their package.json
(same level as name
, private
, source
)."workspaces"
key in the main package.json
yarn workspaces myworkspace
myworkspace
matches the name of your workspace in its package.json
. In my case, the name of the workspace inside the components
folder is called @schon/components
, so I need to address it as yarn worksapces @schon/components
instead.It means a certain package is not installed, and you need to install it.
yarn install
to install the required packages.node_modules
folder and run yarn install
again.node_modules
folder and yarn.lock
file and run yarn install
.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With