Monday, August 22, 2022

Install and compile SASS with npm

npm start // error in Visual Studio Code integrated bash - run separately


sudo apt install nodejs

sudo apt install npm

sudo npm install live-server -g

live-server // in project folder to see changes real-time

sudo npm install node-sass -g // install globally and add to dependencies

npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.

npm WARN deprecated har-validator@5.1.5: this library is no longer supported

npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142

added 240 packages, and audited 241 packages in 25s

19 packages are looking for funding

  run `npm fund` for detail

3 high severity vulnerabilities

To address all issues, run:

  npm audit fix

Run `npm audit` for details.


sudo npm install autoprefixer --save-dev

sudo npm install concat --save-dev

sudo npm install postcss-cli --save-dev

sudo npm install npm-run-all -g


npm init

package.json

{

  "name": "site",

  "version": "1.0.0",

  "description": "Landing page for site",

  "main": "index.js",

  "scripts": {

    "watch:sass": "node-sass sass/main.scss css/style.css -w",

    "devserver": "live-server --browser=firefox",

    "start": "npm-run-all --parallel devserver watch:sass",

    

    "compile:sass": "node-sass sass/main.scss css/style.comp.css",

    "concat:css": "concat -o css/style.concat.css css/icon-font.css css/style.comp.css",

    "prefix:css": "postcss --use autoprefixer -b 'last 10 versions' css/style.concat.css -o css/style.prefix.css",

    "compress:css": "node-sass css/style.prefix.css css/style.css --output-style compressed",

    "build:css": "npm-run-all compile:sass concat:css prefix:css compress:css"

  },

  "author": "Author",

  "license": "ISC",

  "devDependencies": {

    "autoprefixer": "^7.2.6",

    "concat": "^1.0.3",

    "node-sass": "^6.0.1",

    "npm-run-all": "^4.1.5",

    "postcss-cli": "^4.1.1"

  }

}


npm audit fix --force
npm WARN using --force Recommended protections disabled.
npm WARN audit Updating node-sass to 4.5.3, which is a SemVer major change.
npm WARN deprecated tar@2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.
npm ERR! code 1
npm ERR! path /home/user/node_modules/node-sass
npm ERR! command failed
npm ERR! command sh -c -- node scripts/build.js
npm ERR! Building: /usr/bin/node /home/user/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp verb cli [
npm ERR! gyp verb cli   '/usr/bin/node',
npm ERR! gyp verb cli   '/home/user/node_modules/node-gyp/bin/node-gyp.js',
npm ERR! gyp verb cli   'rebuild',
npm ERR! gyp verb cli   '--verbose',
npm ERR! gyp verb cli   '--libsass_ext=',
npm ERR! gyp verb cli   '--libsass_cflags=',
npm ERR! gyp verb cli   '--libsass_ldflags=',
npm ERR! gyp verb cli   '--libsass_library='
npm ERR! gyp verb cli ]
npm ERR! gyp info using node-gyp@3.8.0
npm ERR! gyp info using node@16.14.2 | linux | x64
npm ERR! gyp verb command rebuild []
npm ERR! gyp verb command clean []
npm ERR! gyp verb clean removing "build" directory
npm ERR! gyp verb command configure []
npm ERR! gyp verb check python checking for Python executable "python2" in the PATH
npm ERR! gyp verb `which` failed Error: not found: python2
npm ERR! gyp verb `which` failed     at getNotFoundError (/home/user/node_modules/which/which.js:13:12)
npm ERR! gyp verb `which` failed     at F (/home/user/node_modules/which/which.js:68:19)
npm ERR! gyp verb `which` failed     at E (/home/user/node_modules/which/which.js:80:29)
npm ERR! gyp verb `which` failed     at /home/user/node_modules/which/which.js:89:16
npm ERR! gyp verb `which` failed     at /home/user/node_modules/isexe/index.js:42:5
npm ERR! gyp verb `which` failed     at /home/user/node_modules/isexe/mode.js:8:5
npm ERR! gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:198:21)
npm ERR! gyp verb `which` failed  python2 Error: not found: python2
npm ERR! gyp verb `which` failed     at getNotFoundError (/home/user/node_modules/which/which.js:13:12)
npm ERR! gyp verb `which` failed     at F (/home/user/node_modules/which/which.js:68:19)
npm ERR! gyp verb `which` failed     at E (/home/user/node_modules/which/which.js:80:29)
npm ERR! gyp verb `which` failed     at /home/user/node_modules/which/which.js:89:16
npm ERR! gyp verb `which` failed     at /home/user/node_modules/isexe/index.js:42:5
npm ERR! gyp verb `which` failed     at /home/user/node_modules/isexe/mode.js:8:5
npm ERR! gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:198:21) {
npm ERR! gyp verb `which` failed   code: 'ENOENT'
npm ERR! gyp verb `which` failed }
npm ERR! gyp verb check python checking for Python executable "python" in the PATH
npm ERR! gyp verb `which` failed Error: not found: python
npm ERR! gyp verb `which` failed     at getNotFoundError (/home/user/node_modules/which/which.js:13:12)
npm ERR! gyp verb `which` failed     at F (/home/user/node_modules/which/which.js:68:19)
npm ERR! gyp verb `which` failed     at E (/home/user/node_modules/which/which.js:80:29)
npm ERR! gyp verb `which` failed     at /home/user/node_modules/which/which.js:89:16
npm ERR! gyp verb `which` failed     at /home/user/node_modules/isexe/index.js:42:5
npm ERR! gyp verb `which` failed     at /home/user/node_modules/isexe/mode.js:8:5
npm ERR! gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:198:21)
npm ERR! gyp verb `which` failed  python Error: not found: python
npm ERR! gyp verb `which` failed     at getNotFoundError (/home/user/node_modules/which/which.js:13:12)
npm ERR! gyp verb `which` failed     at F (/home/user/node_modules/which/which.js:68:19)
npm ERR! gyp verb `which` failed     at E (/home/user/node_modules/which/which.js:80:29)
npm ERR! gyp verb `which` failed     at /home/user/node_modules/which/which.js:89:16
npm ERR! gyp verb `which` failed     at /home/user/node_modules/isexe/index.js:42:5
npm ERR! gyp verb `which` failed     at /home/user/node_modules/isexe/mode.js:8:5
npm ERR! gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:198:21) {
npm ERR! gyp verb `which` failed   code: 'ENOENT'
npm ERR! gyp verb `which` failed }
npm ERR! gyp ERR! configure error 
npm ERR! gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
npm ERR! gyp ERR! stack     at PythonFinder.failNoPython (/home/user/node_modules/node-gyp/lib/configure.js:484:19)
npm ERR! gyp ERR! stack     at PythonFinder.<anonymous> (/home/user/node_modules/node-gyp/lib/configure.js:406:16)
npm ERR! gyp ERR! stack     at F (/home/user/node_modules/which/which.js:68:16)
npm ERR! gyp ERR! stack     at E (/home/user/node_modules/which/which.js:80:29)
npm ERR! gyp ERR! stack     at /home/user/node_modules/which/which.js:89:16
npm ERR! gyp ERR! stack     at /home/user/node_modules/isexe/index.js:42:5
npm ERR! gyp ERR! stack     at /home/user/node_modules/isexe/mode.js:8:5
npm ERR! gyp ERR! stack     at FSReqCallback.oncomplete (node:fs:198:21)
npm ERR! gyp ERR! System Linux 5.15.0-46-generic
npm ERR! gyp ERR! command "/usr/bin/node" "/home/user/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
npm ERR! gyp ERR! cwd /home/user/node_modules/node-sass
npm ERR! gyp ERR! node -v v16.14.2
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok 
npm ERR! Build failed with error code: 1

No comments:

Post a Comment