Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explain why yarn is more preferred than npm #8615

Closed
wants to merge 1 commit into from

Conversation

steven-prybylynskyi
Copy link

Currently it's not possible to run encore after installing dependencies with NPM. Error in console:

$ npx encore
/node_modules/@symfony/webpack-encore/bin/encore.js:2
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
          ^^^^^^^

SyntaxError: missing ) after argument list

Only after using yarn the problem was solved.

The lock file is a must, we will know everyone's dependencies are in the same situation.
Unfortunately the package-lock.json file from NPM@5 is not supported by yarn
yarnpkg/yarn#3614

Related:
symfony/webpack-encore#39

Currently it's not possible to run encore after installing dependencies with `NPM`. Error in console:

```
$ npx encore
/node_modules/@symfony/webpack-encore/bin/encore.js:2
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
          ^^^^^^^

SyntaxError: missing ) after argument list
```

Only after using yarn the problem was solved.

The lock file is a must, we will know everyone's dependencies are in the same situation.
Unfortunately the `package-lock.json` file from `NPM@5` is not supported by `yarn`
yarnpkg/yarn#3614

Related:
symfony/webpack-encore#39
@Lyrkan
Copy link
Contributor

Lyrkan commented Nov 10, 2017

Hi @pribilinskiy,

I'm not sure the fact that we use a yarn.lock file in Encore is relevant: when you use Encore in your project its yarn.lock file is not used.

@steven-prybylynskyi
Copy link
Author

Yep, I've just read https://yarnpkg.com/blog/2016/11/24/lockfiles-for-all/
Lockfiles within your dependencies will be ignored.

@stof
Copy link
Member

stof commented Nov 10, 2017

Note that there is a difference between installing Encore in your project with NPM (which should be working already) and running Encore through npx (which downloads Encore in a temporary location to run it).
Support for npx is not something which has been tested in Encore (if you want support for npx, this needs to be discussed in the Encore repo).

@steven-prybylynskyi
Copy link
Author

@stof here it's used only to run Encore instead of npm run encore -- or yarn run encore

@stof
Copy link
Member

stof commented Nov 10, 2017

@pribilinskiy npx is installing the package on its own. It is not an alias for npm run

@steven-prybylynskyi
Copy link
Author

steven-prybylynskyi commented Nov 10, 2017

@stof I'm afraid you aren't right

npx Executes either from a local node_modules/.bin, or from a central cache

@stof
Copy link
Member

stof commented Nov 10, 2017

anyway, please report this to encore. It is not a doc issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants