armin-pfaeffle / sass-autocompile

Automatically compiles SASS files on save ‒ package for atom.io
https://atom.io/packages/sass-autocompile
MIT License
49 stars 14 forks source link

Newbie Question #74

Open samwisegrangee opened 8 years ago

samwisegrangee commented 8 years ago

Vielen Dank für alles das du in deisem Programm gemacht hast! Ich kann kaum erwarten's zu benutzen. Before I've been using CodeKit or Prepros to compile my sass and jade, so I'm looking forward to using this. Doch leider hab' ich ein Problem gefunden.

Now being a guy who always used an external app to compiler, this stuff is all new to me. Node.js and (as far as I can tell) node-sass are installed.

When I try to save, this is what's on my screen: In the bottom it says: SASS-Autocompile: Complitation error EACCES: permission denied, mkdir '/path'

My first line comment is: // compileCompressed: /path/to/your/project/Process Site/_css/style.css (although I've tried several variations of this, which I don't really understand)

My folders in the tree view look like this: v Process Site v _css .DS_Store index.html index.jade style.sass

Was ist los?

It seems like everything works, do I just need to tell sass-autocompile where to put it? Oder?

armin-pfaeffle commented 8 years ago

Hey!

I think you don't have write rights to the root directory /. You are working on Linux or MacOS?

You should use a relative path. Here some examples.:

# Output style.css in the directory where SCSS is located
// compileCompressed: style.css

# If you have a scss and css directory in your project directory, you
# can set this directory:
// compileCompressed: ../css/style.css

I hope it's clear how this is working?

Absolute path can be problematic and should only be used when you really need them!

samwisegrangee commented 8 years ago

What does /bin/sh: node-sass: command not found mean?

armin-pfaeffle commented 8 years ago

That means that Atom cannot find node-sass executable. Perhaps you have not installed node-sass globally? Consider -g at npm install node-sass -g!

If you have installed globally, then open options in Atom, search for sass-autocompile package and its option Path to node-sass command -- it's the last option. Enter /usr/local/bin and try compilation again.

samwisegrangee commented 8 years ago

Oh, I'm a Mac OS X user btw. Yep, I did install node-sass globally, and this time I put in /usr/local/bin

But now I get this: /bin/sh: /usr/local/bin/node-sass: No such file or directory

armin-pfaeffle commented 8 years ago

What is the output when you execute this in your terminal?

which node-sass
samwisegrangee commented 8 years ago

Nothing.

armin-pfaeffle commented 8 years ago

Is there a node-sass executable in /usr/local/bin???

If not, remove node-sass and reinstall it again. It seems that something gone wrong with your installation.

EDIT: Or did you install it somewhere else?

samwisegrangee commented 8 years ago

Hmm, I can't seem in reinstall it. Neither npm install -g node-sass nor sudo npm install -g node-sass are installing it. Before it asked for my password, but not this time.

armin-pfaeffle commented 8 years ago

Well... What is the output of the commands? What about remove and reinstall node.js? I never had this problem, so my help is restricted...

samwisegrangee commented 8 years ago

Hmmm, well the times I've tried to install have given me a lot of npm WARN deprecated minimatch@...Please update to ... (with sudo) or npm ERR! (without sudo).

I have node v4.4.5 and npm -v 2.15.5

Is there any other way to get the node-sass executable file into my usr/local/bin without doing a normal install?

armin-pfaeffle commented 8 years ago

Well... In general, node 4 is supported afaik. Warnings are "normal" at the moment, see here. That's not a problem of my package. But I think that these warnings has no influence on functionality.

Try to install it with sudo, ignore the warning messages and execute node-sass via terminal. Does the output look like?!

Provide a Sass file to render

  Example
    node-sass --output-style compressed foobar.scss foobar.css
    cat foobar.scss | node-sass --output-style compressed > foobar.css

Then check if there is a node-sass executable in /usr/local/bin?!

If so, try to compile a SASS/SCSS file in Atom. If there occurs a command no found error, change option as decribed here.

samwisegrangee commented 8 years ago

I found the node-sass exec file. It's in a path like this:

My Username >node_modules (folder) > node-sass (folder) > bin (folder) > node-sass

When I moved the node-sass exec file into my usr/local/bin folder it said that it requires a bunch of the other modules that came in that folder. Should I simply move them all into usr/local/bin?

samwisegrangee commented 8 years ago

And also thanks for all your attention and help!

armin-pfaeffle commented 8 years ago

Well.. When it's placed under your home directory, then you missed the -g parameter?! You should use sudo npm install node-sass -g.

Moving this executable is wrong! You broke the installation with this ;)

samwisegrangee commented 8 years ago

I've done that, and I always get this. Does this look right? `Samuels-MBP:~ Samwise$ sudo npm install node-sass -g npm WARN deprecated minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue npm WARN deprecated minimatch@0.3.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue npm WARN deprecated minimatch@1.0.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue /Users/Samwise/.npm-global/bin/node-sass -> /Users/Samwise/.npm-global/lib/node_modules/node-sass/bin/node-sass

node-sass@3.8.0 install /Users/Samwise/.npm-global/lib/node_modules/node-sass node scripts/install.js

Binary downloaded and installed at /Users/Samwise/.npm-global/lib/node_modules/node-sass/vendor/darwin-x64-46/binding.node

node-sass@3.8.0 postinstall /Users/Samwise/.npm-global/lib/node_modules/node-sass node scripts/build.js

"/Users/Samwise/.npm-global/lib/node_modules/node-sass/vendor/darwin-x64-46/binding.node" exists. testing binary. Binary is fine; exiting. node-sass@3.8.0 /Users/Samwise/.npm-global/lib/node_modules/node-sass ├── get-stdin@4.0.1 ├── async-foreach@0.1.3 ├── in-publish@2.0.0 ├── lodash.clonedeep@4.3.2 (lodash._baseclone@4.5.7) ├── nan@2.3.5 ├── mkdirp@0.5.1 (minimist@0.0.8) ├── chalk@1.1.3 (escape-string-regexp@1.0.5, ansi-styles@2.2.1, supports-color@2.0.0, strip-ansi@3.0.1, has-ansi@2.0.0) ├── cross-spawn@3.0.1 (lru-cache@4.0.1, which@1.2.10) ├── glob@7.0.5 (path-is-absolute@1.0.0, fs.realpath@1.0.0, inherits@2.0.1, inflight@1.0.5, once@1.3.3, minimatch@3.0.2) ├── gaze@1.0.0 (globule@0.2.0) ├── meow@3.7.0 (trim-newlines@1.0.0, decamelize@1.2.0, map-obj@1.0.1, object-assign@4.1.0, camelcase-keys@2.1.0, minimist@1.2.0, loud-rejection@1.5.0, redent@1.0.0, normalize-package-data@2.3.5, read-pkg-up@1.0.1) ├── request@2.72.0 (tunnel-agent@0.4.3, aws-sign2@0.6.0, forever-agent@0.6.1, oauth-sign@0.8.2, is-typedarray@1.0.0, caseless@0.11.0, stringstream@0.0.5, aws4@1.4.1, isstream@0.1.2, json-stringify-safe@5.0.1, extend@3.0.0, tough-cookie@2.2.2, node-uuid@1.4.7, qs@6.1.0, combined-stream@1.0.5, mime-types@2.1.11, form-data@1.0.0-rc4, bl@1.1.2, hawk@3.1.3, http-signature@1.1.1, har-validator@2.0.6) ├── sass-graph@2.1.2 (yargs@4.7.1, lodash@4.13.1) └── node-gyp@3.3.1 (graceful-fs@4.1.4, semver@5.1.1, which@1.2.10, osenv@0.1.3, nopt@3.0.6, minimatch@1.0.0, fstream@1.0.10, glob@4.5.3, tar@2.2.1, rimraf@2.5.2, npmlog@2.0.4, path-array@1.0.1) Samuels-MBP:~ Samwise$ which node-sass Samuels-MBP:~ Samwise$ brew npm uninstall node-sass Error: Unknown command: npm Samuels-MBP:~ Samwise$ brew npm install node-sass -g Error: Unknown command: npm Samuels-MBP:~ Samwise$ sudo npm install node-sass -g npm WARN deprecated minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue npm WARN deprecated minimatch@0.3.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue npm WARN deprecated minimatch@1.0.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue /Users/Samwise/.npm-global/bin/node-sass -> /Users/Samwise/.npm-global/lib/node_modules/node-sass/bin/node-sass

node-sass@3.8.0 install /Users/Samwise/.npm-global/lib/node_modules/node-sass node scripts/install.js

Binary downloaded and installed at /Users/Samwise/.npm-global/lib/node_modules/node-sass/vendor/darwin-x64-46/binding.node

node-sass@3.8.0 postinstall /Users/Samwise/.npm-global/lib/node_modules/node-sass node scripts/build.js

"/Users/Samwise/.npm-global/lib/node_modules/node-sass/vendor/darwin-x64-46/binding.node" exists. testing binary. Binary is fine; exiting. node-sass@3.8.0 /Users/Samwise/.npm-global/lib/node_modules/node-sass ├── get-stdin@4.0.1 ├── async-foreach@0.1.3 ├── in-publish@2.0.0 ├── lodash.clonedeep@4.3.2 (lodash._baseclone@4.5.7) ├── nan@2.3.5 ├── mkdirp@0.5.1 (minimist@0.0.8) ├── chalk@1.1.3 (escape-string-regexp@1.0.5, ansi-styles@2.2.1, supports-color@2.0.0, strip-ansi@3.0.1, has-ansi@2.0.0) ├── cross-spawn@3.0.1 (lru-cache@4.0.1, which@1.2.10) ├── glob@7.0.5 (path-is-absolute@1.0.0, fs.realpath@1.0.0, inherits@2.0.1, once@1.3.3, inflight@1.0.5, minimatch@3.0.2) ├── meow@3.7.0 (decamelize@1.2.0, map-obj@1.0.1, trim-newlines@1.0.0, object-assign@4.1.0, minimist@1.2.0, camelcase-keys@2.1.0, loud-rejection@1.5.0, redent@1.0.0, normalize-package-data@2.3.5, read-pkg-up@1.0.1) ├── gaze@1.0.0 (globule@0.2.0) ├── request@2.72.0 (aws-sign2@0.6.0, forever-agent@0.6.1, tunnel-agent@0.4.3, oauth-sign@0.8.2, is-typedarray@1.0.0, caseless@0.11.0, stringstream@0.0.5, aws4@1.4.1, isstream@0.1.2, json-stringify-safe@5.0.1, extend@3.0.0, tough-cookie@2.2.2, node-uuid@1.4.7, qs@6.1.0, combined-stream@1.0.5, mime-types@2.1.11, form-data@1.0.0-rc4, hawk@3.1.3, bl@1.1.2, http-signature@1.1.1, har-validator@2.0.6) ├── sass-graph@2.1.2 (yargs@4.7.1, lodash@4.13.1) └── node-gyp@3.3.1 (graceful-fs@4.1.4, semver@5.1.1, which@1.2.10, osenv@0.1.3, nopt@3.0.6, minimatch@1.0.0, fstream@1.0.10, glob@4.5.3, tar@2.2.1, rimraf@2.5.2, npmlog@2.0.4, path-array@1.0.1)`

armin-pfaeffle commented 8 years ago

Have you uninstalled node-sass before? But before try (2), then (1). (1) is for a clean installation, but when (2) works, then it's okay too.

(1) Execute the following two commands:

npm uninstall node-sass
npm uninstall node-sass -g
sudo npm uninstall node-sass
sudo npm uninstall node-sass -g

This should remove any installation, done with sudo or without.

After that reinstall node-sass globally:

sudo node-sass install node-sass -g

Can you now find node-sass file under /usr/local/bin? What is the output of which node-sass? What when you execute node-sass?

(2) You can set the Path to node-sass command to this path /Users/Samwise/.npm-global/lib/node_modules and try compilation in Atom again.

samwisegrangee commented 8 years ago
  1. I did it all. I could not find a file called node-sass under /usr/local/bin. It is in /Users/Samwise/.npm-global/lib/node_modules/node-sass and I was even able to open it in Finder.
  2. If I set the path to /Users/Samwise/.npm-global/lib/node_modules what else do I need (like first line comments, etc) in order to compile?
armin-pfaeffle commented 8 years ago

Ok... That's really interessting. I have no MacOS X system right now, so I cannot test that!

Well, you need to install node-sass, setup the path, set a first-line command (but you must not) and then you can compile the file, see shortcuts. Or you set a first line comment and when you have enabled option Compile on Save (with is default) the file is automatically compiled when you save the file.

// compileCompressed: style.css
armin-pfaeffle commented 8 years ago

Any updates? Else I will close that issue.

estherj-hsu commented 8 years ago

Hi, I got the same problem with my Mac OS. I can use command node-sass --output-style compresses style.sass > style.css to compile sass file. But it still shows error if I tried to use auto-compile. And there's no node-sass folder under /usr/local/bin... Is there any way to solve this?

Thank you :)

samwisegrangee commented 8 years ago

Sorry for the delay in getting back to you, Armin.

Thanks for all your support on this, but I think it has something to do with me using Mac OS.

Does Mac OS make a difference? I noticed you mentioned you use a PC, and all the people I see using your program are PC as well.

-SG

On Tue, Aug 30, 2016 at 12:11 AM, estherj-hsu notifications@github.com wrote:

Hi, I got the same problem with my Mac OS. I can use command node-sass --output-style compresses style.sass > style.css to compile sass file. But it still shows error if I'd like to use auto-compile. And there's no node-sass folder under /usr/local/bin... Is there any way to solve this?

Thank you :)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/armin-pfaeffle/sass-autocompile/issues/74#issuecomment-243328043, or mute the thread https://github.com/notifications/unsubscribe-auth/APoguRAhX5VoNaj-TK7fHFzOGELbDsNTks5qk61-gaJpZM4I83zR .

​S A M ​ G R A N G E R CREATIVE. ​ ​ THINKER. ​ ​ WORDSMITH.​ _​WEBSITE: _samwisegrangee.github.io/samgranger/ https://samwisegrangee.github.io/samgranger/ ​SOCIAL: @samwisegrangee ​PHONE: ​269.355.4165​ http://269.355.4165/

,,Du bist der Anfang der sich groß ergießt und ich bin der langsame bange Amen, das deine Schönheit scheu beschließt."

armin-pfaeffle commented 8 years ago

Perhaps I found a problem in my code. Can you open developer tools (View -> Developer -> Toggle Developer Tools) and execute the "command" process.env.PATH and process.env.Path in console tab?! Can you post the output?

armin-pfaeffle commented 8 years ago

@estherj-hsu: Can you execute which node-sass in your terminal and post the output here?!

estherj-hsu commented 8 years ago

Here is the output I got: /Users/apple/.nvm/versions/node/v6.3.1/bin/node-sass

Thank you :)

armin-pfaeffle commented 8 years ago

Can you give me the output of which npm?

Now I have a Mac OS in a virtual machine, so I can test some things.

Can you tell me how you installed nodejs? Perhaps via Homebrew oder any other package manager?

estherj-hsu commented 8 years ago

Here is the output of which npm : /Users/apple/.nvm/versions/node/v6.3.1/bin/npm And I used the package from http://nodejs.org/ to install nodejs.

armin-pfaeffle commented 8 years ago

That's strange... When I download current nodejs package and want to install it, everything is installed to /usr/local/. Do you now why npm is placed in your user directory?

Do you have different nodejs version installed?

armin-pfaeffle commented 8 years ago

@estherj-hsu: have you tried to set Path to node-sass command to /Users/apple/.nvm/versions/node/v6.3.1/bin? Does this fix your problem?

armin-pfaeffle commented 8 years ago

@samwisegrangee: For you the same: install node-sass globally via sudo npm install node-sass -g and search for node-sass executable via which node-sass. If output is like that /path1/path2/path3/node-sass, put /path1/path2/path3 as Path to node-sass command option. This worked for me.

estherj-hsu commented 8 years ago

I change the path to node-sass command with /Users/apple/.nvm/versions/node/v6.3.1/bin/ and it works! ❤ Thank you for your help! 👍

armin-pfaeffle commented 8 years ago

Great to hear that it works now!

ScorpioCoding commented 7 years ago

Hi there I also had this isa single whitespace sue and discoverd that I had a single whitespace before the double forward slashes _// compileCompressed: /path/to/your/project/Process Site/_css/style.css be shore to remove the whitespace before //

emb03 commented 6 years ago

@estherj-hsu can you tell me what steps you took to `change the path to node-sass command with /Users/apple/.nvm/versions/node/v6.3.1/bin/'? Did you make an alias, or did you do this in the sass file?

armin-pfaeffle commented 6 years ago

Have a look at this option.

emb03 commented 6 years ago

@armin-pfaeffle I did see that but it doesn't make any sense to me. I need more detailed information. I know what to do I just don't know how to do it. My node-sass (global install) is which node-sass is located here: /Users/chris/.nvm/versions/node/v9.10.1/bin/node-sass but I want to use atom sass-autocompile but atom can't find node-sass because it is not in usr/local/bin How do I point atom to the right directory? Do I do that is the scss file or do I make a alias in my bash profile? thanks!

armin-pfaeffle commented 6 years ago

No, you cannot set this in the SCSS/SASS file, you must set this path in sass-autocompile options. You even don't need to create any alias.

Open settings of Atom (Ctrl+,), select Packages on the left, search for sass-autocompile and press the Settings button for this package. Then scroll down to the last option Path to 'node-sass' command and set enter path /Users/chris/.nvm/versions/node/v9.10.1/bin/. Now my package should find the node-sass executable.

emb03 commented 6 years ago

aha! Thank you so much!