Search code examples
yarnpkg

Yarn add --dev returning --> yarn: error: no such option: --dev


I have looked at this post: Yarn error "no such option" with --dev flag but it did not work for me. I did the npm install --global yarn and it did not work.

yarn version: 0.27
node version: 9.6.1
npm version: 5.6.0
linux-ubuntu: 17.10

commad being run:

yarn add --dev nodemon babel-cli babel-preset-env babel-preset-stage-3

Solution

  • I had a similar problem while running the command:

    yarn add --dev eslint prettier eslint-config-airbnb@^15.0.1 eslint-config-prettier eslint-plugin-prettier eslint-plugin-react eslint-plugin-import eslint-plugin-jsx-a11y@^5.1.1
    
    yarn: error: no such option: --dev
    

    adding sudo to the command helped me!

    sudo npm install --global yarn