webpack-encore: error Command "encore" not found.

Hello, I have installed Encore in Symfony3.3 on linux-VM.

 composer require encore
 yarn install

when I run yarn run encore dev I got error Command "encore" not found.

I have checked node_modules/.bin/ and it contains only uuid.

Do you have any suggestion?

regards,

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 20 (3 by maintainers)

Most upvoted comments

@engharb You’re still using the same outdated version of Yarn there:

yarn add v0.21.3 [1/4] Resolving packages… [2/4] Fetching packages…

Yarn v0.21.3 was released almost a year ago, the current stable version is the 1.3.2.

Try the following:

  • Remove the node_modules directory and the yarn.lock file if you have one
  • Update yarn to v1.3.2 (see https://yarnpkg.com/en/docs/install)
  • Run yarn add --dev @symfony/webpack-encore again

Hi everyone I have the same problem and I want to share with you my solution First, I change my package. Json to this

{ “devDependencies”: { “@symfony/webpack-encore/”: “^0.22.0”, “webpack-notifier”: “^1.6.0” }, “license”: “UNLICENSED”, “private”: true, “scripts”: { “dev-server”: “encore dev-server”, “dev”: “./node_modules/@symfony/webpack-encore/bin/encore.js dev”, “watch”: “./node_modules/@symfony/webpack-encore/bin/encore.js dev --watch”, “build”: “./node_modules/@symfony/webpack-encore/bin/encore.js production --progress” } }

and I run rhis command: yarn run dev

I already have a packge.json file before in my symfony project, I used Gulp to pre-compile my assets, Now I following the encore tutorial in documentation, but not works, So, I check the recipes in symfony, and add following to package.json:

 "scripts": {
        "dev-server": "encore dev-server",
        "dev": "encore dev",
        "watch": "encore dev --watch",
        "build": "encore production --progress"
    }

and reinstall yarn add --dev @symfony/webpack-encore, then everything works!

I think the documentation show be notice users that them are already have a package.json file

thank you a lot, I followed the instructions from @Lyrkan and it was succeeded.

regards,