How to install node-sass on Ubuntu 18.04, and How to succesfully compile .scss file to css?












1















I have tried this answers but it didn't work.



I am trying to compile files in my scss folder to regular css files but it's hanged in between.



I installed node-sass from npm and it gives error as



gd@gd10:~/Desktop/portfolio/portfolio$ sudo npm install -g node-sass
[sudo] password for gd:
/usr/local/bin/node-sass -> /usr/local/lib/node_modules/node-sass/bin/node-sass

> node-sass@4.9.2 install /usr/local/lib/node_modules/node-sass
> node scripts/install.js

Unable to save binary /usr/local/lib/node_modules/node-sass/vendor/linux-x64-64 :{ Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/node-sass/vendor'
at Object.mkdirSync (fs.js:738:3)
at sync (/usr/local/lib/node_modules/node-sass/node_modules/mkdirp/index.js:71:13)
at Function.sync (/usr/local/lib/node_modules/node-sass/node_modules/mkdirp/index.js:77:24)
at checkAndDownloadBinary (/usr/local/lib/node_modules/node-sass/scripts/install.js:114:11)
at Object.<anonymous> (/usr/local/lib/node_modules/node-sass/scripts/install.js:157:1)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
errno: -13,
syscall: 'mkdir',
code: 'EACCES',
path: '/usr/local/lib/node_modules/node-sass/vendor' }

> node-sass@4.9.2 postinstall /usr/local/lib/node_modules/node-sass
> node scripts/build.js

Building: /usr/local/bin/node /usr/local/lib/node_modules/node-sass/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
gyp info it worked if it ends with ok
gyp verb cli [ '/usr/local/bin/node',
gyp verb cli '/usr/local/lib/node_modules/node-sass/node_modules/node-gyp/bin/node-gyp.js',
gyp verb cli 'rebuild',
gyp verb cli '--verbose',
gyp verb cli '--libsass_ext=',
gyp verb cli '--libsass_cflags=',
gyp verb cli '--libsass_ldflags=',
gyp verb cli '--libsass_library=' ]
gyp info using node-gyp@3.7.0
gyp info using node@10.6.0 | linux | x64
gyp verb command rebuild
gyp verb command clean
gyp verb clean removing "build" directory
gyp verb command configure
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb `which` succeeded python2 /usr/bin/python2
gyp verb check python version `/usr/bin/python2 -c "import platform; print(platform.python_version());"` returned: "2.7.15rc1n"
gyp verb get node dir no --target version specified, falling back to host node version: 10.6.0
gyp verb command install [ '10.6.0' ]
gyp verb install input version string "10.6.0"
gyp verb install installing version: 10.6.0
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version is already installed, need to check "installVersion"
gyp verb got "installVersion" 9
gyp verb needs "installVersion" 9
gyp verb install version is good
gyp verb get node dir target node version installed: 10.6.0
gyp verb build dir attempting to create "build" dir: /usr/local/lib/node_modules/node-sass/build
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/node-sass/build'
gyp ERR! System Linux 4.15.0-29-generic
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/node-sass/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /usr/local/lib/node_modules/node-sass
gyp ERR! node -v v10.6.0
gyp ERR! node-gyp -v v3.7.0
gyp ERR! not ok
Build failed with error code: 1
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-sass@4.9.2 postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass@4.9.2 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /home/gd/.npm/_logs/2018-08-05T16_10_00_943Z-debug.log
gd@gd10:~/Desktop/portfolio/portfolio$









share|improve this question



























    1















    I have tried this answers but it didn't work.



    I am trying to compile files in my scss folder to regular css files but it's hanged in between.



    I installed node-sass from npm and it gives error as



    gd@gd10:~/Desktop/portfolio/portfolio$ sudo npm install -g node-sass
    [sudo] password for gd:
    /usr/local/bin/node-sass -> /usr/local/lib/node_modules/node-sass/bin/node-sass

    > node-sass@4.9.2 install /usr/local/lib/node_modules/node-sass
    > node scripts/install.js

    Unable to save binary /usr/local/lib/node_modules/node-sass/vendor/linux-x64-64 :{ Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/node-sass/vendor'
    at Object.mkdirSync (fs.js:738:3)
    at sync (/usr/local/lib/node_modules/node-sass/node_modules/mkdirp/index.js:71:13)
    at Function.sync (/usr/local/lib/node_modules/node-sass/node_modules/mkdirp/index.js:77:24)
    at checkAndDownloadBinary (/usr/local/lib/node_modules/node-sass/scripts/install.js:114:11)
    at Object.<anonymous> (/usr/local/lib/node_modules/node-sass/scripts/install.js:157:1)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    errno: -13,
    syscall: 'mkdir',
    code: 'EACCES',
    path: '/usr/local/lib/node_modules/node-sass/vendor' }

    > node-sass@4.9.2 postinstall /usr/local/lib/node_modules/node-sass
    > node scripts/build.js

    Building: /usr/local/bin/node /usr/local/lib/node_modules/node-sass/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
    gyp info it worked if it ends with ok
    gyp verb cli [ '/usr/local/bin/node',
    gyp verb cli '/usr/local/lib/node_modules/node-sass/node_modules/node-gyp/bin/node-gyp.js',
    gyp verb cli 'rebuild',
    gyp verb cli '--verbose',
    gyp verb cli '--libsass_ext=',
    gyp verb cli '--libsass_cflags=',
    gyp verb cli '--libsass_ldflags=',
    gyp verb cli '--libsass_library=' ]
    gyp info using node-gyp@3.7.0
    gyp info using node@10.6.0 | linux | x64
    gyp verb command rebuild
    gyp verb command clean
    gyp verb clean removing "build" directory
    gyp verb command configure
    gyp verb check python checking for Python executable "python2" in the PATH
    gyp verb `which` succeeded python2 /usr/bin/python2
    gyp verb check python version `/usr/bin/python2 -c "import platform; print(platform.python_version());"` returned: "2.7.15rc1n"
    gyp verb get node dir no --target version specified, falling back to host node version: 10.6.0
    gyp verb command install [ '10.6.0' ]
    gyp verb install input version string "10.6.0"
    gyp verb install installing version: 10.6.0
    gyp verb install --ensure was passed, so won't reinstall if already installed
    gyp verb install version is already installed, need to check "installVersion"
    gyp verb got "installVersion" 9
    gyp verb needs "installVersion" 9
    gyp verb install version is good
    gyp verb get node dir target node version installed: 10.6.0
    gyp verb build dir attempting to create "build" dir: /usr/local/lib/node_modules/node-sass/build
    gyp ERR! configure error
    gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/node-sass/build'
    gyp ERR! System Linux 4.15.0-29-generic
    gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/node-sass/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
    gyp ERR! cwd /usr/local/lib/node_modules/node-sass
    gyp ERR! node -v v10.6.0
    gyp ERR! node-gyp -v v3.7.0
    gyp ERR! not ok
    Build failed with error code: 1
    npm ERR! code ELIFECYCLE
    npm ERR! errno 1
    npm ERR! node-sass@4.9.2 postinstall: `node scripts/build.js`
    npm ERR! Exit status 1
    npm ERR!
    npm ERR! Failed at the node-sass@4.9.2 postinstall script.
    npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

    npm ERR! A complete log of this run can be found in:
    npm ERR! /home/gd/.npm/_logs/2018-08-05T16_10_00_943Z-debug.log
    gd@gd10:~/Desktop/portfolio/portfolio$









    share|improve this question

























      1












      1








      1


      1






      I have tried this answers but it didn't work.



      I am trying to compile files in my scss folder to regular css files but it's hanged in between.



      I installed node-sass from npm and it gives error as



      gd@gd10:~/Desktop/portfolio/portfolio$ sudo npm install -g node-sass
      [sudo] password for gd:
      /usr/local/bin/node-sass -> /usr/local/lib/node_modules/node-sass/bin/node-sass

      > node-sass@4.9.2 install /usr/local/lib/node_modules/node-sass
      > node scripts/install.js

      Unable to save binary /usr/local/lib/node_modules/node-sass/vendor/linux-x64-64 :{ Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/node-sass/vendor'
      at Object.mkdirSync (fs.js:738:3)
      at sync (/usr/local/lib/node_modules/node-sass/node_modules/mkdirp/index.js:71:13)
      at Function.sync (/usr/local/lib/node_modules/node-sass/node_modules/mkdirp/index.js:77:24)
      at checkAndDownloadBinary (/usr/local/lib/node_modules/node-sass/scripts/install.js:114:11)
      at Object.<anonymous> (/usr/local/lib/node_modules/node-sass/scripts/install.js:157:1)
      at Module._compile (internal/modules/cjs/loader.js:689:30)
      at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
      at Module.load (internal/modules/cjs/loader.js:599:32)
      at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
      at Function.Module._load (internal/modules/cjs/loader.js:530:3)
      errno: -13,
      syscall: 'mkdir',
      code: 'EACCES',
      path: '/usr/local/lib/node_modules/node-sass/vendor' }

      > node-sass@4.9.2 postinstall /usr/local/lib/node_modules/node-sass
      > node scripts/build.js

      Building: /usr/local/bin/node /usr/local/lib/node_modules/node-sass/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
      gyp info it worked if it ends with ok
      gyp verb cli [ '/usr/local/bin/node',
      gyp verb cli '/usr/local/lib/node_modules/node-sass/node_modules/node-gyp/bin/node-gyp.js',
      gyp verb cli 'rebuild',
      gyp verb cli '--verbose',
      gyp verb cli '--libsass_ext=',
      gyp verb cli '--libsass_cflags=',
      gyp verb cli '--libsass_ldflags=',
      gyp verb cli '--libsass_library=' ]
      gyp info using node-gyp@3.7.0
      gyp info using node@10.6.0 | linux | x64
      gyp verb command rebuild
      gyp verb command clean
      gyp verb clean removing "build" directory
      gyp verb command configure
      gyp verb check python checking for Python executable "python2" in the PATH
      gyp verb `which` succeeded python2 /usr/bin/python2
      gyp verb check python version `/usr/bin/python2 -c "import platform; print(platform.python_version());"` returned: "2.7.15rc1n"
      gyp verb get node dir no --target version specified, falling back to host node version: 10.6.0
      gyp verb command install [ '10.6.0' ]
      gyp verb install input version string "10.6.0"
      gyp verb install installing version: 10.6.0
      gyp verb install --ensure was passed, so won't reinstall if already installed
      gyp verb install version is already installed, need to check "installVersion"
      gyp verb got "installVersion" 9
      gyp verb needs "installVersion" 9
      gyp verb install version is good
      gyp verb get node dir target node version installed: 10.6.0
      gyp verb build dir attempting to create "build" dir: /usr/local/lib/node_modules/node-sass/build
      gyp ERR! configure error
      gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/node-sass/build'
      gyp ERR! System Linux 4.15.0-29-generic
      gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/node-sass/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
      gyp ERR! cwd /usr/local/lib/node_modules/node-sass
      gyp ERR! node -v v10.6.0
      gyp ERR! node-gyp -v v3.7.0
      gyp ERR! not ok
      Build failed with error code: 1
      npm ERR! code ELIFECYCLE
      npm ERR! errno 1
      npm ERR! node-sass@4.9.2 postinstall: `node scripts/build.js`
      npm ERR! Exit status 1
      npm ERR!
      npm ERR! Failed at the node-sass@4.9.2 postinstall script.
      npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

      npm ERR! A complete log of this run can be found in:
      npm ERR! /home/gd/.npm/_logs/2018-08-05T16_10_00_943Z-debug.log
      gd@gd10:~/Desktop/portfolio/portfolio$









      share|improve this question














      I have tried this answers but it didn't work.



      I am trying to compile files in my scss folder to regular css files but it's hanged in between.



      I installed node-sass from npm and it gives error as



      gd@gd10:~/Desktop/portfolio/portfolio$ sudo npm install -g node-sass
      [sudo] password for gd:
      /usr/local/bin/node-sass -> /usr/local/lib/node_modules/node-sass/bin/node-sass

      > node-sass@4.9.2 install /usr/local/lib/node_modules/node-sass
      > node scripts/install.js

      Unable to save binary /usr/local/lib/node_modules/node-sass/vendor/linux-x64-64 :{ Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/node-sass/vendor'
      at Object.mkdirSync (fs.js:738:3)
      at sync (/usr/local/lib/node_modules/node-sass/node_modules/mkdirp/index.js:71:13)
      at Function.sync (/usr/local/lib/node_modules/node-sass/node_modules/mkdirp/index.js:77:24)
      at checkAndDownloadBinary (/usr/local/lib/node_modules/node-sass/scripts/install.js:114:11)
      at Object.<anonymous> (/usr/local/lib/node_modules/node-sass/scripts/install.js:157:1)
      at Module._compile (internal/modules/cjs/loader.js:689:30)
      at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
      at Module.load (internal/modules/cjs/loader.js:599:32)
      at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
      at Function.Module._load (internal/modules/cjs/loader.js:530:3)
      errno: -13,
      syscall: 'mkdir',
      code: 'EACCES',
      path: '/usr/local/lib/node_modules/node-sass/vendor' }

      > node-sass@4.9.2 postinstall /usr/local/lib/node_modules/node-sass
      > node scripts/build.js

      Building: /usr/local/bin/node /usr/local/lib/node_modules/node-sass/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
      gyp info it worked if it ends with ok
      gyp verb cli [ '/usr/local/bin/node',
      gyp verb cli '/usr/local/lib/node_modules/node-sass/node_modules/node-gyp/bin/node-gyp.js',
      gyp verb cli 'rebuild',
      gyp verb cli '--verbose',
      gyp verb cli '--libsass_ext=',
      gyp verb cli '--libsass_cflags=',
      gyp verb cli '--libsass_ldflags=',
      gyp verb cli '--libsass_library=' ]
      gyp info using node-gyp@3.7.0
      gyp info using node@10.6.0 | linux | x64
      gyp verb command rebuild
      gyp verb command clean
      gyp verb clean removing "build" directory
      gyp verb command configure
      gyp verb check python checking for Python executable "python2" in the PATH
      gyp verb `which` succeeded python2 /usr/bin/python2
      gyp verb check python version `/usr/bin/python2 -c "import platform; print(platform.python_version());"` returned: "2.7.15rc1n"
      gyp verb get node dir no --target version specified, falling back to host node version: 10.6.0
      gyp verb command install [ '10.6.0' ]
      gyp verb install input version string "10.6.0"
      gyp verb install installing version: 10.6.0
      gyp verb install --ensure was passed, so won't reinstall if already installed
      gyp verb install version is already installed, need to check "installVersion"
      gyp verb got "installVersion" 9
      gyp verb needs "installVersion" 9
      gyp verb install version is good
      gyp verb get node dir target node version installed: 10.6.0
      gyp verb build dir attempting to create "build" dir: /usr/local/lib/node_modules/node-sass/build
      gyp ERR! configure error
      gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/node-sass/build'
      gyp ERR! System Linux 4.15.0-29-generic
      gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/node-sass/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
      gyp ERR! cwd /usr/local/lib/node_modules/node-sass
      gyp ERR! node -v v10.6.0
      gyp ERR! node-gyp -v v3.7.0
      gyp ERR! not ok
      Build failed with error code: 1
      npm ERR! code ELIFECYCLE
      npm ERR! errno 1
      npm ERR! node-sass@4.9.2 postinstall: `node scripts/build.js`
      npm ERR! Exit status 1
      npm ERR!
      npm ERR! Failed at the node-sass@4.9.2 postinstall script.
      npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

      npm ERR! A complete log of this run can be found in:
      npm ERR! /home/gd/.npm/_logs/2018-08-05T16_10_00_943Z-debug.log
      gd@gd10:~/Desktop/portfolio/portfolio$






      nodejs css grunt






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Aug 5 '18 at 16:12









      ganeshdeshmukhganeshdeshmukh

      484513




      484513






















          2 Answers
          2






          active

          oldest

          votes


















          1














          I used sudo npm install --unsafe-perm gulp-sass to install gulp-sass






          share|improve this answer































            0














            I finally found a solution



            sudo npm install --unsafe-perm node-sass


            I hope this will help many of us.






            share|improve this answer























              Your Answer








              StackExchange.ready(function() {
              var channelOptions = {
              tags: "".split(" "),
              id: "89"
              };
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function() {
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled) {
              StackExchange.using("snippets", function() {
              createEditor();
              });
              }
              else {
              createEditor();
              }
              });

              function createEditor() {
              StackExchange.prepareEditor({
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: true,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: 10,
              bindNavPrevention: true,
              postfix: "",
              imageUploader: {
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              },
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              });


              }
              });














              draft saved

              draft discarded


















              StackExchange.ready(
              function () {
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1062626%2fhow-to-install-node-sass-on-ubuntu-18-04-and-how-to-succesfully-compile-scss-f%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              1














              I used sudo npm install --unsafe-perm gulp-sass to install gulp-sass






              share|improve this answer




























                1














                I used sudo npm install --unsafe-perm gulp-sass to install gulp-sass






                share|improve this answer


























                  1












                  1








                  1







                  I used sudo npm install --unsafe-perm gulp-sass to install gulp-sass






                  share|improve this answer













                  I used sudo npm install --unsafe-perm gulp-sass to install gulp-sass







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Sep 30 '18 at 6:47









                  sirsir

                  111




                  111

























                      0














                      I finally found a solution



                      sudo npm install --unsafe-perm node-sass


                      I hope this will help many of us.






                      share|improve this answer




























                        0














                        I finally found a solution



                        sudo npm install --unsafe-perm node-sass


                        I hope this will help many of us.






                        share|improve this answer


























                          0












                          0








                          0







                          I finally found a solution



                          sudo npm install --unsafe-perm node-sass


                          I hope this will help many of us.






                          share|improve this answer













                          I finally found a solution



                          sudo npm install --unsafe-perm node-sass


                          I hope this will help many of us.







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Dec 13 '18 at 14:08









                          Goran7777Goran7777

                          187




                          187






























                              draft saved

                              draft discarded




















































                              Thanks for contributing an answer to Ask Ubuntu!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function () {
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1062626%2fhow-to-install-node-sass-on-ubuntu-18-04-and-how-to-succesfully-compile-scss-f%23new-answer', 'question_page');
                              }
                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              How to change which sound is reproduced for terminal bell?

                              Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

                              Can I use Tabulator js library in my java Spring + Thymeleaf project?