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

If using stylus package it is not possible to run from anywhere else than root directory #1655

Closed
mitar opened this issue Dec 4, 2013 · 15 comments

Comments

@mitar
Copy link
Contributor

mitar commented Dec 4, 2013

If using stylus package it is not possible to run Meteor from anywhere else than root directory. So if you run Meteor from client or server directory you get Stylus errors.

@mitar
Copy link
Contributor Author

mitar commented Dec 4, 2013

Here is example repository. Go into client or server directory and run meteor. You will get something like:

=> Errors prevented startup:

While building the application:
error: Stylus compiler error: client/test-stylus.styl:1
 > 1| @import variables
   2| 

failed to locate @import file variables.styl

@n1mmy
Copy link
Contributor

n1mmy commented Dec 6, 2013

Thanks for the clear repro. I have replicated this. It sure looks like a bug. Will look into it.

@stubailo
Copy link
Contributor

I don't think this is the case anymore, especially not in Meteor 1.2 since we have rewritten this package from the ground up.

@snshn
Copy link

snshn commented Jul 12, 2017

I can confirm the bug still exists in Meteor 1.5:

=> Errors prevented startup:                  
   
   While processing files with stylus (for target web.browser):
   packages/app:core/css/main.styl: Stylus compiler error: css/main.styl:1:9
   1| @import 'general.import'
   --------------^
   2| 
   3| @import 'buttons.import'
   4| @import 'tabs.import'
   
   failed to locate @import file general.import.styl
   
   
=> Your application has errors. Waiting for file change.

As seen from the log, I'm using the legacy "packages/" structure within the app.
The error's only being thrown upon inital compilation though -- once I trigger the live reload Meteor won't throw this error any longer and start the app just fine.

@snshn
Copy link

snshn commented Jul 17, 2017

upd: to bypass the issue I have to trigger the live reload by modifying the file in which the error occurs (e.g. main.styl in case of the example). I now get two of these errors in my project, as I am now using stylus in more than one package. @meteor, please fix this one!

@hwillson
Copy link
Contributor

@vflyson Can you link to a small, runnable reproduction (using Meteor 1.5.1) that demonstrates this issue (see Reporting a bug in Meteor)?

@snshn
Copy link

snshn commented Jul 18, 2017

@snshn
Copy link

snshn commented Jul 19, 2017

upd:
Tried to build my app, getting the same error (fails to build):

meteor build --architecture os.linux.x86_64 ../dist/live/
Errors prevented bundling:                    
While processing files with stylus (for target web.browser):
packages/app:core/css/main.styl: Stylus compiler error: css/main.styl:3:9
1| /* packages/core/css/main.styl */
2| 
3| @import 'general.import'
--------------^
...

It seems like most people use the unofficial package mquandalle:stylus which does not have this problem. I will try to use that one instead, until meteor:stylus is fixed.

@snshn
Copy link

snshn commented Jul 23, 2017

@benjamn @Slava Please let me know if you'd like me to create a separate issue for this, unless you're already working on fixing it for the next release.

@hwillson
Copy link
Contributor

Hi @vflyson - if you adjust your api.addFiles call in app/packages/core/package.js to look like

  api.addFiles([
    'css/main.styl',
    'css/general.import.styl',
    'html/index.html',
  ], 'client');

things should work properly. This isn't a stylus issue; your general.import.styl file just isn't being included in your package.

@snshn
Copy link

snshn commented Jul 23, 2017

Hey @hwillson
I've tried doing that before, and it didn't work the same as including general.import.styl via @import.
It also does not explain why after triggering the live reload on main.styl the stylus package is able to find and import my .import.styl files.

@hwillson
Copy link
Contributor

On my side when I run your repro locally (using the Meteor Tool), without making any changes, it works properly first try:

screenshot 2017-07-23 12 19 39

screenshot 2017-07-23 12 19 48

The only time I get an issue is when I try to meteor build. By adding that missing file to your package.json however (and still keeping the @import 'general.import' statement in your main.styl), I can then build properly.

@snshn
Copy link

snshn commented Jul 23, 2017

Could you please try running meteor add stylus and meteor remove stylus and see if it triggers the issue? I remember that I've managed to run my repo with @import the first time as well, and then it got somehow broken, possibly after removing and adding packages.

@snshn
Copy link

snshn commented Jul 23, 2017

Debian x86_64 here, here're the steps on my end:

git clone git@github.com:vflyson/meteor-stylus-package-bug.git bug
cd bug/app
meteor npm install
meteor --port 3090

And I get

=> Started proxy.                             
=> Errors prevented startup:                  
   
   While processing files with stylus (for target web.browser):
   packages/app:core/css/main.styl: Stylus compiler error: css/main.styl:3:9
   1| /* packages/core/css/main.styl */
   2| 
   3| @import 'general.import'
   --------------^
   4| 
   
   failed to locate @import file general.import.styl

right away.

It is likely that the live reload conflicts with how stylus imports files upon initial Meteor start, and it is likely related to code responsible for inotify on Linux (perhaps you're using macOS, @hwillson?).

@hwillson
Copy link
Contributor

Bizarre @vflyson - your repro is working for me on macOS and Ubuntu 16.

screenshot 2017-07-23 20 37 31

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

6 participants