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

[Question] Proper way to run Parcel during parcel development? #182

Closed
davidnagli opened this issue Dec 10, 2017 · 6 comments
Closed

[Question] Proper way to run Parcel during parcel development? #182

davidnagli opened this issue Dec 10, 2017 · 6 comments

Comments

@davidnagli
Copy link
Contributor

What's the correct way to run the Parcel CLI commands during development for Parcel?

Currently, I'm just calling node bin/cli.js [args], but this causes some issues since it uses /bin as the "current directory", instead of the place where I actually want to run Parcel.

For example, when I run:

node ../repo/bin/cli.js src/index.html

I get:

Error: Cannot find module './package.json' from '/Users/[redacted]/projects/Parcel/example/src'
✨  Built in 552ms.

However, I do have a package.json located in /Parcel/example/package.json

Here's my setup:
screen shot 2017-12-09 at 8 12 14 pm

So... what's the best way to run parcel during development?

@davidnagli davidnagli added the 💬 RFC Request For Comments label Dec 10, 2017
@davidnagli
Copy link
Contributor Author

davidnagli commented Dec 10, 2017

I'm thinking maybe there should be a way that I can add Parcel to my $PATH or something so that it works as it does when I install it through npm.

@davidnagli davidnagli added ❔ Question and removed 💬 RFC Request For Comments labels Dec 10, 2017
@chee
Copy link

chee commented Dec 10, 2017

if you yarn global remove parcel then you can cd into your own copy of parcel and yarn link, then the parcel in your path will be your own parcel

@chee
Copy link

chee commented Dec 10, 2017

Also, you can yarn link in the directory of your copy of parcel, then in another project you can do yarn link parcel-bundler so that locally your copy of parcel is the one used in its npm scripts.

@davidnagli
Copy link
Contributor Author

davidnagli commented Dec 10, 2017

@chee How do I get it into my PATH in the first place? Should I symlink it into /usr/local/bin or do I add something to .bashrc?

I tried googling it, but I was pretty confused.

@davidnagli davidnagli changed the title [RFC] Proper way to run Parcel during parcel development? [Question] Proper way to run Parcel during parcel development? Dec 10, 2017
@brandon93s
Copy link
Contributor

brandon93s commented Dec 10, 2017

I use an alias:

image

This allows me to use the local copy of parcel as if it was globally installed. Yarn recommends the same pattern for development.

The equivalent for PowerShell users:

image

@chee
Copy link

chee commented Dec 10, 2017

@davidnagli If your globally installed yarn bins are already in your path, then it will work just like that.
If not then you'll need to add your yarn global bin path to your $PATH in your shell init,

something like this:

echo "PATH=$(yarn global bin):\$PATH" >> .bashrc

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

No branches or pull requests

3 participants