GNU/Linux >> LINUX-Kenntnisse >  >> Ubuntu

Wie installiere ich Node-sass unter Ubuntu 18.04 und wie kompiliere ich die .scss-Datei erfolgreich in CSS?

Ich habe diese Antworten versucht, aber es hat nicht funktioniert.

Ich versuche, Dateien in meinem scss zu kompilieren Ordner in normales css Dateien, aber es wird dazwischen gehängt.

Ich habe node-sass von npm installiert und es gibt einen Fehler wie

[email protected]:~/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

> [email protected] 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' }

> [email protected] postinstall /usr/local/lib/node_modules/node-sass
> node scripts/build.js

Building: /usr/local/bin/node //eadn-wc01-5196795.nxedge.io/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   '//eadn-wc01-5196795.nxedge.io/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 [email protected]
gyp info using [email protected] | 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" "//eadn-wc01-5196795.nxedge.io/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! [email protected] postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] 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
[email protected]:~/Desktop/portfolio/portfolio$

Akzeptierte Antwort:

Endlich habe ich eine Lösung gefunden

sudo npm install --unsafe-perm node-sass

Ich hoffe, dass dies vielen von uns helfen wird.

Verwandte:Kann keine neuen Ordner erstellen – Ubuntu auf VirtualBox?
Ubuntu
  1. So installieren Sie PHP 7.4 und 8.0 auf Ubuntu 18.04 oder 20.04

  2. So installieren Sie Anaconda unter Ubuntu 18.04 und 20.04

  3. So installieren und verwenden Sie das Siege-Benchmarking-Tool unter Ubuntu 20.04

  4. So installieren Sie g ++ unter Ubuntu

  5. So installieren Sie ClamAV unter Ubuntu 20.04

So installieren Sie TeamViewer 12 auf Ubuntu 16.04 und Ubuntu 16.10

So installieren Sie ScreenCloud unter Ubuntu 16.04 und Ubuntu 17.04

So installieren und machen Sie Nemo zum Standard-Dateimanager in Ubuntu

So installieren und verwenden Sie R unter Ubuntu

So installieren und konfigurieren Sie die Samba-Dateifreigabe unter Ubuntu 20.04

So installieren Sie Monitorix unter Ubuntu 16.04