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_m...

@engharb

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

Hi engharb,
Any error displayed during yarn install ?

@engharb

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

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

@engharb

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

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

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

but the file node-modules exists in the project.

@engharb

this is the right one ls -al node_modules/

and works.

@petegore

Yep sorry I meant node_modules/ dir

@stof

@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

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

@petegore

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

@Lyrkan

@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

@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

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

@Lyrkan

@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
renishv8, flaveris, georgemilojevic, samayo, maximmandrik, akoh-victor, coqmos, Baldrani, jessicapineros, arechsteiner, and 25 more reacted with thumbs up emoji
hedera-s and axometeam reacted with hooray emoji
gberna10, toihidhiq, karvas, hedera-s, J7mbo, gialang, amisfa, Yakov32, Kurtis-Hill, kasali, and Constantin-Hentgen reacted with heart emoji
toihidhiq, HoussemTN, and hedera-s reacted with rocket emoji

@engharb

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

regards,

@commorad-zekri

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

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

Thanks Lyrkan ,
It works for me in symfony 4.3.

I am currently stuck at the Encore/Webpack installation. I followed the steps at symfony.com. But when continuing to the simple example I got stuck at running yarn encore dev. I get the error: «Command «encore» not found». I also have an error when running symfony server:start after installing Encore and navigating to a view:

An exception has been thrown during the rendering of a template ("Could not find the entrypoints file from Webpack: the file "path/entrypoints.json" does not exist.").

As far as I know the entrypoints.json should have been autogenerated. I have Yarn 1.22.10 and NodeJS 14.16.1.

What I have done

I executed the commands composer require symfony/webpack-encore-bundle
and yarn install

  1. I looked at StackOveflow questions ‘error Command «encore» not found.’ when running ‘yarn run encore’ in Symfony4, webpack encore dev-server not found /, Error Command «encore» not found. (separate backend webpack), Can’t run encore dev
  2. I executed the command composer require webpack
  3. I noticed my package.json doesn’t have a scripts object where the command encore dev is supposed to be living. I watched a YouTube video and followed it (https://youtu.be/Fs_4FMoSO90). That’s why I know this. I wonder why I don’t have it. Below is the package.json from the video. My package.json only has the dev dependency Bootstrap.
  4. Executed npm install

Package.json from video:

{
  "devDependencies": {
    "@symfony/webpack-encore": "^0.31.0",
    "core-js": "^3.0.0",
    "regenerator-runtime": "^0.13.2",
    "webpack-notifier": "^1.6.0"
  },
  "license": "UNLICENSED",
  "private": true,
  "scripts": {
    "dev-server": "encore dev-server",
    "dev": "encore dev",
    "watch": "encore dev --watch",
    "build": "encore production --progress"
  }
}

My package.json:

{
  "devDependencies": {
    "bootstrap": "^5.0.0"
  }
}

I removed the package.json, package-lock.json and executed yarn install again and it installed some packages. I didn’t need NPM. I already got Bootstrap from my Yarn.lock (that’s the only thing in there). I still have both errors though.

After Yivi’s advice I executed composer req webpack, yarn install and yarn encore dev. The difference is that I executed composer require symfony/webpack-encore-bundle which is what is mentioned on the installation page on the symfony website. The yarn encore dev command tries to run webpack now, but I get the following error: Error: Encore.enableStimulusBridge is not a recognized property or method. webpack.config.js:26 Object.<anonymous>

webpack.config.js line 26

    // enables the Symfony UX Stimulus bridge (used in assets/bootstrap.js)
    .enableStimulusBridge('./assets/controllers.json')

I work in a Symfony 4.2 project, and try to use Bootstrap theming (so I need to compile Sass code). I followed the process given in the official doc, which indicates to use webpack-encore. But I have an error when using it accordingly to the doc.

Here is the page indicating the process :
https://symfony.com/doc/current/frontend/encore/simple-example.html

So I installed Encore, and then I launch yarn run encore. And here is what it says in the terminal :

yarn run v1.16.0
warning package.json: No license field
error Command "encore" not found.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

So I visited the site indicated in the error, which says :

You may define scripts in your package.json file.

And if I look in my package.json in the root directory, it indeed only says :

  "devDependencies": {
    "bootstrap": "^4.3.1",
    "jquery": "^3.4.1",
    "node-sass": "^4.12.0",
    "popper": "^1.0.1",
    "sass-loader": "^7.0.1"
  }
}

There is no script for any encore command :-(

However the rest seems good. Here is an extract of composer.json :

...
    "require": {
...
        "symfony/webpack-encore-bundle": "^1.5",
...
    },
...

And I have a webpack.config.js .

I runned composer require encore and yarn install without any error.

But nowhere in the Symfony doc I found anything about tweaking the package.json oO So how do I make it work ? Why doesn’t the yarn run encore work ?

Hello @smirgol,

I just tried all the steps from the beginning and it seems to work fine (I removed some irrelevant lines):

$ composer create-project symfony/skeleton:4.1.* test-flex-encore
Installing symfony/skeleton (v4.1.3.4)
  - Installing symfony/skeleton (v4.1.3.4): Loading from cache
Created project in test-flex-encore
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Package operations: 20 installs, 0 updates, 0 removals
  - Installing symfony/flex (v1.1.0): Loading from cache

Prefetching 13 packages 🎶 💨
  - Downloading (100%)

  - Installing psr/cache (1.0.1): Loading from cache
  - (...)
Executing script cache:clear [OK]
Executing script assets:install public [OK]

Some files may have been created or updated to configure your new packages.
Please review, edit and commit them: these files are yours.

$ cd test-flex-encore

$ composer req webpack-encore
Using version ^1.0 for symfony/webpack-encore-pack
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Restricting packages listed in "symfony/symfony" to "4.1.*"

Prefetching 2 packages 🎶 💨
  - Downloading (100%)

Package operations: 2 installs, 0 updates, 0 removals
  - Installing symfony/asset (v4.1.3): Loading from cache
  - Installing symfony/webpack-encore-pack (v1.0.3): Loading from cache
Writing lock file
Generating autoload files
Symfony operations: 1 recipe (946f323b0f42b0c17f87b1c727106aff)
  - Configuring symfony/webpack-encore-pack (>=1.0): From github.com/symfony/recipes:master
Executing script cache:clear [OK]
Executing script assets:install public [OK]

$ yarn install
yarn install v1.7.0
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
Done in 18.34s.

$ yarn encore dev              
yarn run v1.7.0
$ /home/lyrkan/Tests/test-flex-encore/node_modules/.bin/encore dev
Running webpack ...

 DONE  Compiled successfully in 667ms                                   00:05:10

 I  3 files written to public/build
Done in 1.25s.

Did you have the issue when adding Encore to an existing flex project?
If yes, did you already have a package.json file in the root folder?

This is my install order for a fresh project:

composer create-project symfony/website-skeleton myproject
cd myproject

composer require symfony/apache-pack
composer require symfony/orm-pack
composer require symfony/maker-bundle --dev

[configure .env for doctrine and init database]

yarn add bootstrap --dev
yarn add jquery --dev
yarn add popper.js --dev

composer require webpack-encore
yarn install

Since I’ve installed bootstrap, jquery and popper before Encore, I do have a package.json, yes.

{
  "devDependencies": {
    "bootstrap": "^4.1.3",
    "jquery": "^3.3.1",
    "popper.js": "^1.14.4"
  }
}

Edit:
It does indeed work if I install Encore before I install anything else with yarn. Once I’ve installed something with yarn, like bootstrap, it no longer works. Is there a workaround/fix for this, so I can add Encore to my existing project, or would I need to reinstall everything from scratch?

Edit2: About the workaround:
I’ve copied the relevant parts from the new created project’s package.json to my existing project and called yarn install. Looks like it installed something. Gave me some warnings though:

yarn install v1.9.4
[1/4] Resolving packages...
warning @symfony/webpack-encore > css-loader > cssnano > autoprefixer > [email protected]: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
warning @symfony/webpack-encore > css-loader > cssnano > postcss-merge-rules > [email protected]: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
warning @symfony/webpack-encore > css-loader > cssnano > postcss-merge-rules > caniuse-api > [email protected]: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
[2/4] Fetching packages...
info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.

I’ll see if it works anyway. :)

When you require webpack-encore the recipe tries to copy this default package.json file.
As you can see it contains the depencies missing in your case and some useful npm/yarn scripts.

The catch is… that copy doesn’t happen if a file already exists (to avoid overwriting user’s files).

It should work fine if you add bootstrap/jquery/popper.js after calling composer require webpack-encore.

It does, yes. Encore is now working. :+1:
If one already has an existing project, it helps to create a fresh project, install Encore and make a manual diff on the package.json.

Maybe this could/should be pointed out in the tutorial, it’s not really an obvious issue for those new to Symfony/Encore. It’s not a given thing that the very first thing you install with yarn is Encore and then you’re stuck.

Hmm, maybe… but that’s a behavior that you’d encounter with all flex recipes that use the «copy-from-recipe» configurator and for other files than the package.json.

I’m not sure how we could word that without basically saying «look at all the files in the Encore recipe and merge them manually if you already have them».

@weaverryan WDYT?

I just had this same problem. Would be useful to add something to the docs to say if you are already had a package.json, then (do something, manually merge?) before the yarn install.

(Thanks to @Lyrkan for linking the package.json it copies, I have merged it with my existing package.json which has fixed the issue)

Hello,
As smirgol did, I installed bootstrap before webpack-encore. So I encounter the error warning package.json: No license field, error Command "encore" not found. So I already have a package.json file containing {
"devDependencies": {
"bootstrap": "^4.1.3"
}
}
.

So I understand that I have to merge my existing package.json with the default one linked here on 25 august, but it links to a 404.

If it is the right thing to do, could you please give me a link to the default package.json I should merge mine with? Thanks

Well, the problem I had was because yarn install and yarn add was removing the @symfony files in node_modules.

Make sure your NODE_ENV environment variable exists and is set to «development», yarn install —production=false will do the trick as well, otherwise if you add any other packages it may end up removing them (the bastard).

This is why the command will not be found, at least in my case.

@dukeofgaming Unless you have NODE_ENV set to production you shouldn’t have to do that since yarn install includes dev dependencies by default.

@Lyrkan I made sure that NODE_ENV did not exist before I set it, so by default it seemed to be behaving as production. I noticed this initially when encore would work just after adding the @symfony/webpack-encore with the —dev flag, but not after adding webpack-notifier.

In any case, hopefully this solution is useful for someone.

@dukeofgaming You may have a .yarnrc file somewhere then. What does it show when you run yarn config get production?

@Lyrkan the difference is that most recipes are copying a config file named after the bundle, so conflicts are much less likely. In an existing project, there is a good chance that there is already a package.json.

@stof I agree with that, I opened an issue about it on flex’s repository a while ago (https://github.com/symfony/flex/issues/428)… but I’m still not sure what’s the best way to handle it.

For me, this issue was resolved by just running yarn install

package.json doesn’t get indeed updated with the «scripts» section which is needed to run the commands from the tutorial. You can try to add them manually to avoid creating a new project and installing all again.

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

I just spent some time on this as well :smiley:
So I created a new project and this is what you get, copy/paste in package.json run yarn install and then yarn encore dev should work!

{
  "devDependencies": {
    "@symfony/webpack-encore": "^0.28.0",
    "core-js": "^3.0.0",
    "regenerator-runtime": "^0.13.2",
    "webpack-notifier": "^1.6.0"
  },
  "license": "UNLICENSED",
  "private": true,
  "scripts": {
    "dev-server": "encore dev-server",
    "dev": "encore dev",
    "watch": "encore dev --watch",
    "build": "encore production --progress"
  }
}

Simply following instructions:

https://symfony.com/doc/current/frontend/encore/installation.html

docker-compose exec php composer require symfony/webpack-encore-bundle
Xdebug: [Step Debug] Could not connect to debugging client. Tried: host.docker.internal:9003 (fallback through xdebug.client_host/xdebug.client_port) :-(
Using version ^1.12 for symfony/webpack-encore-bundle
./composer.json has been updated
Running composer update symfony/webpack-encore-bundle
Loading composer repositories with package information
Updating dependencies
Lock file operations: 1 install, 0 updates, 0 removals
  - Locking symfony/webpack-encore-bundle (v1.12.0)
Writing lock file
Installing dependencies from lock file (including require-dev)
Nothing to install, update or remove
Generating optimized autoload files
composer/package-versions-deprecated: Generating version class...
composer/package-versions-deprecated: ...done generating version class
111 packages you are using are looking for funding.
Use the `composer fund` command to find out more!

Run composer recipes at any time to see the status of your Symfony recipes.

Executing script cache:clear [OK]
Executing script assets:install public [OK]

Nothing to unpack


yarn install
yarn install v1.22.11
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
Done in 0.04s.

If you are using Symfony Flex, this will quotes uvdos webpack-encore install and enable the WebpackEncoreBundle, quotes uvdos webpack-encore create the assets/ directory, add a quotes uvdos webpack-encore webpack.config.js file, and add quotes uvdos webpack-encore node_modules/ to .gitignore. You can skip quotes uvdos webpack-encore the rest of this article and go write your quotes uvdos webpack-encore first JavaScript and CSS by reading Encore: quotes uvdos webpack-encore Setting up your Project!

I have not turned off flex, so it should quotes uvdos webpack-encore have install those files, but it did not.
It quotes uvdos webpack-encore only added encore bundle to composer.json, quotes uvdos webpack-encore updated composer.lock , created quotes uvdos webpack-encore .yarn-integrity

{
  "systemParams": "linux-x64-59",
  "modulesFolders": [
    "node_modules"
  ],
  "flags": [],
  "linkedModules": [],
  "topLevelPatterns": [],
  "lockfileEntries": {},
  "files": [],
  "artifacts": {}
}

and yarn.lock:

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

When I run composer recipes:

docker-compose exec php composer recipes
Xdebug: [Step Debug] Could not connect to debugging client. Tried: host.docker.internal:9003 (fallback through xdebug.client_host/xdebug.client_port) :-(

                      
 Available recipes.   
                      

 * doctrine/annotations 
 * doctrine/doctrine-bundle 
 * doctrine/doctrine-migrations-bundle 
 * phpunit/phpunit 
 * sensio/framework-extra-bundle 
 * symfony/console 
 * symfony/debug-bundle 
 * symfony/flex 
 * symfony/framework-bundle 
 * symfony/mailer 
 * symfony/maker-bundle 
 * symfony/monolog-bundle 
 * symfony/notifier 
 * symfony/phpunit-bridge 
 * symfony/routing 
 * symfony/security-bundle 
 * symfony/translation 
 * symfony/twig-bundle 
 * symfony/validator 
 * symfony/web-profiler-bundle 
 * symfony/webpack-encore-bundle (recipe not installed)
 * twig/extra-bundle 

Run:
 * composer recipes vendor/package to see details about a recipe.
 * composer recipes:install vendor/package --force -v to update that recipe.

I then run

docker-compose exec php composer recipes:install symfony/webpack-encore-bundle 
Xdebug: [Step Debug] Could not connect to debugging client. Tried: host.docker.internal:9003 (fallback through xdebug.client_host/xdebug.client_port) :-(
Run command with -v to see more details


Symfony operations: 1 recipe (795220943d71c24e78b567cea3978461)
  - Configuring symfony/webpack-encore-bundle (>=1.9): From github.com/symfony/recipes:master

Webpack config and various files are quotes uvdos webpack-encore installed. But node_modules still only has quotes uvdos webpack-encore .yarn-integrity file
.

And running this, I get error:

yarn encore dev
yarn run v1.22.11
error Command "encore" not found.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

What am I missing? Or it is a bug in quotes uvdos webpack-encore program/documention?

Update

Tried:

 yarn add --dev @symfony/webpack-encore

Getting:

Couldn’t find package quotes uvdos webpack-encore «@symfony/stimulus-bridge» on the «npm» quotes uvdos webpack-encore registry

Why it even searches on npm registry if I quotes uvdos webpack-encore use yarn?

Update 2

Did you not install yarn through npm package quotes uvdos webpack-encore manager? If not I
recommend you do that. npm quotes uvdos webpack-encore install —global yarn

I can’t remember how did I install yarn and quotes uvdos webpack-encore I do not know how to check.
Tried:

npm install --global yarn

> yarn@1.22.11 preinstall /home/darius/.nvm/versions/node/v9.11.2/lib/node_modules/yarn
> :; (node ./preinstall.js > /dev/null 2>&1 || true)

/home/darius/.nvm/versions/node/v9.11.2/bin/yarn -> /home/darius/.nvm/versions/node/v9.11.2/lib/node_modules/yarn/bin/yarn.js
/home/darius/.nvm/versions/node/v9.11.2/bin/yarnpkg -> /home/darius/.nvm/versions/node/v9.11.2/lib/node_modules/yarn/bin/yarn.js
+ yarn@1.22.11
updated 1 package in 0.497s

Then again

yarn add --dev @symfony/webpack-encore
yarn add v1.22.11
[1/4] Resolving packages...
⠄ @symfony/stimulus-bridge@^2.0.0
error Couldn't find package "@symfony/stimulus-bridge" on the "npm" registry.
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

Update 3

Yes, I am mixing commands — some run from quotes uvdos webpack-encore docker, some from host machine. Yarn I run quotes uvdos webpack-encore from host because I do not know yet how to quotes uvdos webpack-encore install on docker, I have tried, but no quotes uvdos webpack-encore success. Is that bad that I use yarn, npm quotes uvdos webpack-encore from host?

And volumes information you can see in quotes uvdos webpack-encore docker-compose.yml:

version: "3"
services:
    php:
        build: docker/php
        volumes:
            - .:/app:cached

            # for xdebug
            - ./docker/php/conf.d/xdebug.ini:/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
#            - ./docker/php/conf.d/error_reporting.ini:/usr/local/etc/php/conf.d/error_reporting.ini
            # end for xdebug
        working_dir: /app
        container_name: margin_php
        depends_on:
            - mysql

    nginx:
        image: nginx:1.15.0
        ports:
            - 127.0.0.1:${NGINX_PORT}:80
        volumes:
            - .:/app:cached
            - ./docker/nginx/default.conf:/etc/nginx/conf.d/default.conf:cached
        container_name: margin_nginx
        depends_on:
            - php

    mysql:
        image: mysql:8.0
        volumes:
            - ./docker/mysql/data:/var/lib/mysql
        ports:
            - 127.0.0.1:${MYSQL_PORT}:3306
        environment:
            MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
            MYSQL_DB_NAME: ${MYSQL_DB_NAME}
        container_name: margin_mysql

Я добавил buildpack heroku / nodejs в свое приложение Symfony heroku, и я могу установить свои зависимости yarn.

Однако я не могу бежать

$ yarn run encore production 

У меня всегда одна и та же ошибка Command "encore" not found независимо от того, запускаю ли я команду в composer.json:

// composer.json
 "compile": [
     "node_modules/.bin/encore production",
     [•••]

Или в package.json

//package.json

  "scripts": {
    "heroku-postbuild" : "yarn run encore production"
    [•••]

3 ответа

Я всегда запускаю команды Encore как cd my-project/ && ./node_modules/.bin/encore .... Это сработает для вас?


0

Javier Eguiluz
11 Окт 2017 в 11:11

Всем, кто сюда придет, вам сначала нужно добавить пакет сборки узла в свое приложение согласно этот вопрос.

Убедитесь, что вы добавили buildpack узла перед php.

Затем добавьте "node_modules/.bin/encore production" в вашу компиляцию (как показано в вопросе).

Наконец, как написано в комментарии, не забудьте изменить зависимости веб-пакетов с devDependencies на dependencies в вашем package.json.


1

Jonathan Simonney
5 Дек 2018 в 20:14

В корневом файле package.json:

"scripts": {
    ...
    "heroku-postbuild" : "node_modules/.bin/encore production"
}

Он запустит ваш веб-пакет на бис и другие ваши модули npm.


5

ylaakel
27 Июл 2018 в 01:24

Понравилась статья? Поделить с друзьями:

Читайте также:

  • Error comma colon decorator or end of line expected after operand
  • Error combo little inferno
  • Error com epicgames fortnite invalid parameter
  • Error column specified more than once
  • Error column reference title is ambiguous

  • 0 0 голоса
    Рейтинг статьи
    Подписаться
    Уведомить о
    guest

    0 комментариев
    Старые
    Новые Популярные
    Межтекстовые Отзывы
    Посмотреть все комментарии