symfony / webpack-encore

A simple but powerful API for processing & compiling assets built around Webpack
https://symfony.com/doc/current/frontend.html
MIT License
2.23k stars 198 forks source link

error Command "encore" not found. #251

Closed engharb closed 6 years ago

engharb commented 6 years ago

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,

petegore commented 6 years ago

Hi engharb, Any error displayed during yarn install ?

engharb commented 6 years ago

Hi petegore, Yes here is it when I run yarn install

yarn install v0.21.3
[1/4] Resolving packages...
[2/4] Fetching packages...
warning fsevents@1.1.3: The platform "linux" is incompatible with this module.
info "fsevents@1.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
error An unexpected error occurred: "ELOOP: too many symbolic links encountered, scandir '/home/vagrant/project/node_modules/crypto-browserify/test/vectors'".
info If you think this is a bug, please open a bug report with the information provided in "/home/vagrant/project/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
petegore commented 6 years ago

Ok and what's in /home/vagrant/project/yarn-error.log ?

engharb commented 6 years ago

Here is the yarn-error:

Arguments: 
  /usr/bin/nodejs /usr/bin/yarn install

PATH: 
  /home/vagrant/.composer/vendor/bin:/home/vagrant/bin:/home/vagrant/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

Yarn version: 
  0.21.3

Node version: 
  6.10.2

Platform: 
  linux x64

npm manifest: 
  {
      "devDependencies": {
          "@symfony/webpack-encore": "^0.17.0"
      },
      "license": "UNLICENSED",
      "private": true,
      "scripts": {
          "dev-server": "encore dev-server",
          "dev": "encore dev",
          "watch": "encore dev --watch",
          "build": "encore production"
      }
  }

yarn manifest: 
  No manifest

Lockfile: 
  # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
  # yarn lockfile v1

Trace: 
  Error: ELOOP: too many symbolic links encountered, scandir '/home/vagrant/project/node_modules/crypto-browserify/test/vectors'
      at Error (native)
petegore commented 6 years ago

Okay I don't see anything about encore there. Can you run ls -al node_modules/.bin/ ? And by the way, do you run composerand yarn into the same folder ?

engharb commented 6 years ago

here is the result ls: cannot access 'node-modules/': No such file or directory

but the file node-modules exists in the project.

engharb commented 6 years ago

this is the right one ls -al node_modules/

and works.

petegore commented 6 years ago

Yep sorry I meant node_modules/ dir

stof commented 6 years ago

@petegore there is nothing about encore in the error message. But there is an error during the yarn install. so if the failure happened before encore itself was installed, this explains what it is bot here. And even if encore was there, some of its dependencies may also be missing due to the yarn install failure. So having a working setup involves making yarn install work.

engharb commented 6 years ago

@stof I haven't any errors while running composer require encore.

petegore commented 6 years ago

Can't it be a permissions issue ? Yarn not allowed to create bin files ; or the user unable to execute it ?

Lyrkan commented 6 years ago

@petegore Could you try updating yarn ? the version you're using is quite old (yarn install doesn't exist anymore and has been replaced by yarn add)

stof commented 6 years ago

@engharb composer requiring encore is just about applying a Flex recipe generating the package.json with a encore requirement. this is not installing encore, because Encore is not a PHP package, but a node.js one.

engharb commented 6 years ago

After i run : $ yarn add @symfony/webpack-encore --dev

yarn add v0.21.3
[1/4] Resolving packages...
[2/4] Fetching packages...
warning fsevents@1.1.3: The platform "linux" is incompatible with this module.
info "fsevents@1.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning "babel-loader@7.1.2" has unmet peer dependency "babel-core@6 || 7 || ^7.0.0-alpha || ^7.0.0-beta || ^7.0.0-rc".
warning "babel-loader@7.1.2" has unmet peer dependency "webpack@2 || 3".
warning "extract-text-webpack-plugin@3.0.2" has unmet peer dependency "webpack@^3.1.0".
warning "webpack-dev-server@2.11.1" has unmet peer dependency "webpack@^2.2.0 || ^3.0.0".
warning "webpack-dev-middleware@1.12.2" has unmet peer dependency "webpack@^1.0.0 || ^2.0.0 || ^3.0.0".
warning "uglifyjs-webpack-plugin@0.4.6" has unmet peer dependency "webpack@^1.9 || ^2 || ^2.1.0-beta || ^2.2.0-rc || ^3.0.0".
error An unexpected error occurred: "ELOOP: too many symbolic links encountered, scandir '/home/vagrant/GeheimnessWebsite/node_modules/crypto-browserify/test/vectors'".
info If you think this is a bug, please open a bug report with the information provided in "/home/vagrant/project/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

it is the same error.

@stof should I try to install it using npm if possible?

stof commented 6 years ago

@engharb yes, you can try

Lyrkan commented 6 years ago

@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:

engharb commented 6 years ago

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

regards,

commorad-zekri commented 5 years ago

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

TangMonk commented 5 years ago

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

toihidhiq commented 5 years ago

Thanks Lyrkan , It works for me in symfony 4.3.

devlopersabbir commented 2 months ago

@TangMonk sorry to say, bro, i'm still getting this error. image

stof commented 2 months ago

@devlopersabbir please open a dedicated issue and provide the full information to reproduce that instead of commenting on an issue closed in 2019 (btw, the error you get is not even mentioning the error message used in this issue which was command "encore" not found so I'm 100% sure that it is a different issue