sayou
sayou

Reputation: 913

Symfony4 : ./node_modules/.bin/encore: No such file or directory

I try to use webpack to generate assets on Symfony4

I started by adding it using yarn :

yarn add @symfony/webpack-encore --dev

On the installation I get this error

error An unexpected error occurred: "EPROTO: protocol error, symlink '../../../parser/bin/babel-parser.js' -> '/home/vagrant/Symfony/node_modules/@babel/core/node_modules/.bin/parser'".

After a search on the net, I found that the solution is by adding --no-bin-links, so I try it and the installation ended without any error.

but when I want to generate the assets by this command

./node_modules/.bin/encore dev

I get this error (.bin folder not found)

-bash: ./node_modules/.bin/encore: No such file or directory

and when I try to use this command yarn encore dev or yarn run encore dev

error Command "encore" not found.

I searched a lot on the net, but nothing works, is there any solution to fix this problem ?

PS : I use Vagrant and Homestead

Upvotes: 1

Views: 2401

Answers (2)

sayou
sayou

Reputation: 913

I fixed by editing the scripts on package.json by :

"scripts": {
        "dev-server": "./node_modules/@symfony/webpack-encore/bin/encore.js 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"
    }

and I use this command to generate the assets yarn run dev

Upvotes: 1

MartinKondor
MartinKondor

Reputation: 432

Either use yarn 1.12.1 or install the packages with npm.

It's an issue with yarn, source, issue.

Upvotes: 0

Related Questions