14

After reinstall of my Kubuntu 18 I tried to run my @vue/cli 4.0.5 / vuex 3 app and got error : error Missing list of packages to add to your project

serge@AtHome:/mnt/_work_sdb8/wwwroot/lar/VApps/vtasks$ node -v
v14.12.0
serge@AtHome:/mnt/_work_sdb8/wwwroot/lar/VApps/vtasks$ yarn -v
1.22.5
serge@AtHome:/mnt/_work_sdb8/wwwroot/lar/VApps/vtasks$ yarn add
yarn add v1.22.5
error Missing list of packages to add to your project.
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
serge@AtHome:/mnt/_work_sdb8/wwwroot/lar/VApps/vtasks$ yarn upgrade
yarn upgrade v1.22.5
error No lockfile in this directory. Run `yarn install` to generate one.
info Visit https://yarnpkg.com/en/docs/cli/upgrade for documentation about this command.
serge@AtHome:/mnt/_work_sdb8/wwwroot/lar/VApps/vtasks$ lsb_release -d; uname -r; uname -i
Description:    Ubuntu 18.04.5 LTS
4.15.0-118-generic
x86_64

My package.json :

{
  "name": "ctasks",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "serve": "vue-cli-service serve",
    "build": "vue-cli-service build",
    "test:e2e": "vue-cli-service test:e2e",
    "test:unit": "vue-cli-service test:unit",
    "lint": "vue-cli-service lint"
  },
  "dependencies": {
    "@voerro/vue-tagsinput": "^2.2.0",
    "@vue/cli-plugin-babel": "^4.4.1",
    "axios": "^0.19.0",
    "core-js": "^3.3.2",
    "cypress-file-upload": "^3.5.3",
    "file-saver": "^2.0.2",
    "font-awesome": "^4.7.0",
    "idle-vue": "^2.0.5",
    "moment": "^2.24.0",
    "moment-timezone": "^0.5.27",
    "v-money": "^0.8.1",
    "vee-validate": "^3.1.0",
    "vue": "^2.6.10",
    "vue-avatar": "^2.1.8",
    "vue-context-menu": "^2.0.6",
    "vue-focus": "^2.1.0",
    "vue-head": "^2.2.0",
    "vue-js-modal": "^1.3.31",
    "vue-nav-tabs": "^0.5.7",
    "vue-notification": "^1.3.20",
    "vue-phone-number-input": "^1.1.9",
    "vue-router": "^3.1.3",
    "vue-select": "^3.2.0",
    "vue-simple-calendar": "^4.3.2",
    "vue-simple-suggest": "^1.10.1",
    "vue-slider-component": "^3.1.1",
    "vue-the-mask": "^0.11.1",
    "vue-upload-component": "^2.8.20",
    "vue-wysiwyg": "^1.7.2",
    "vue2-datepicker": "^3.3.0",
    "vue2-filters": "^0.8.0",
    "vuex": "^3.0.1"
  },
  "devDependencies": {
    "@vue/cli-plugin-e2e-cypress": "~4.2.0",
    "@vue/cli-plugin-eslint": "~4.2.0",
    "@vue/cli-plugin-router": "^4.0.0",
    "@vue/cli-plugin-vuex": "^4.0.0",
    "@vue/cli-service": "^4.0.0",
    "babel-eslint": "^10.0.3",
    "bootstrap": "^4.3.1",
    "eslint": "^6.7.2",
    "eslint-plugin-vue": "^6.1.2",
    "faker": "^4.1.0",
    "jquery": "^3.4.1",
    "node-sass": "^4.12.0",
    "popper.js": "^1.16.0",
    "sass-loader": "^8.0.0",
    "vue-template-compiler": "^2.6.10"
  },
  "eslintConfig": {
    "root": true,
    "env": {
      "node": true
    },
    "extends": [
      "plugin:vue/essential",
      "eslint:recommended"
    ],
    "parserOptions": {
      "parser": "babel-eslint"
    },
    "rules": {
      "semi": [
        2,
        "never"
      ]
    }
  }
}

Why error and how to fix it ? Before reinstall of my Kubuntu it worked ok. Did I miss some configurations? I installed lates node, npm, yarn. Thanks!

7 Answers 7

29

Reading the doc of yarn add (https://classic.yarnpkg.com/en/docs/cli/add/), you need to specify the package that you want to install.

if you want to add a package:

yarn add vue #same as npm install vue

if you want to load all the dependency from the package.json

yarn #same as npm install

if you want to run custom command from package.json

yarn serve #same as npm run serve

The error you see from yarn is because you don't specify any package to install, so he tell you : "give me the name (or names) of the package(s) that you want me to install in this project"

10

I got the same error when trying to replace npm install command with yarn add but I didn't notice the --save-dev flag that was there - which is unsupported by yarn.

In my case - simply removing the --save-dev flag worked. I'm guessing more flags will cause the same error

As @Flafy mentioned - could also be a -d instead of a -D on a yarn add commamnd

1
  • 3
    I used -d instead of -D when trying to do yarn add
    – Flafy
    Commented Mar 5, 2022 at 11:51
5

Doing -D instead of --save-dev solved the issue for me.

3

This solve it for me. If you want to install packages with yarn, you need to put the packages after "yarn add" eg. yarn add "package" --save

using "yarn add --save-dev" "package", yarn probably will not see what you want to add, thus saying "error Missing list of packages to add to your project."

2

You need to tell yarn which packages to install.

In your case, you want to install all of the packages in your json, so you can use the same command that you used above:
>> yarn add
followed by the UNIX single dot command (.) meaning "in this execution context"/"working directory"to get:
>> yarn add .

0
  1. Remove "private": true,
  2. Save your package.json
  3. Run npm install
  4. Put "private": true, where you removed it from again
  5. Save it...Done
0
0

The error message from yarn is wrong they should change it. Easy mistake is that you use:

yarn add -d babel-plugin-styled-components

instead of the -D (for dev dependencies) how it should be:

yarn add -D babel-plugin-styled-components

And it will throw this error despite the list of plugin is there and correct.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.