Reputation: 25
My compilation process does not work and as I am a beginner I do not know why. Any constructive help is highly appreciated ;).
I have spent like 24 hours to solve the problem without success... I have reinstalled all packages, cleaned cache etc., but nothing has helped.
{
"name": "natours",
"version": "1.0.0",
"description": "Landing page for natours",
"main": "index.js",
"scripts": {
"watch:sass": "node-sass sass/main.scss css/style.css -w",
"devserver": "live-server",
"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 ten 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": "Jonas",
"license": "ISC",
"devDependencies": {
"autoprefixer": "^10.0.0",
"concat": "^1.0.3",
"libs": "^0.1.2",
"node-sass": "^4.14.1",
"npm-run-all": "^4.1.5",
"postcss": "^8.0.5",
"postcss-cli": "^7.1.2"
},
"dependencies": {
"live-server": "^1.2.1"
}
}
When I run command npm run prefix:css I get such error:
npm run prefix:css
> [email protected] prefix:css /home/piotr/Documents/personal/ProgrammingBooks/HTML, CSS/advanced-css-course-master/Natours/starter
> postcss --use autoprefixer -b 'last ten versions' css/style.concat.css -o css/style.prefix.css
Error: PostCSS plugin autoprefixer requires PostCSS 8. Update PostCSS or downgrade this plugin.
at Processor.normalize (/home/piotr/Documents/personal/ProgrammingBooks/HTML, CSS/advanced-css-course-master/Natours/starter/node_modules/postcss-cli/node_modules/postcss/lib/processor.js:167:15)
at new Processor (/home/piotr/Documents/personal/ProgrammingBooks/HTML, CSS/advanced-css-course-master/Natours/starter/node_modules/postcss-cli/node_modules/postcss/lib/processor.js:56:25)
at postcss (/home/piotr/Documents/personal/ProgrammingBooks/HTML, CSS/advanced-css-course-master/Natours/starter/node_modules/postcss-cli/node_modules/postcss/lib/postcss.js:55:10)
at /home/piotr/Documents/personal/ProgrammingBooks/HTML, CSS/advanced-css-course-master/Natours/starter/node_modules/postcss-cli/index.js:216:14
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] prefix:css: `postcss --use autoprefixer -b 'last ten versions' css/style.concat.css -o css/style.prefix.css`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] prefix:css 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/piotr/.npm/_logs/2020-09-18T21_58_54_802Z-debug.log
-------------
I also add COMPLETE LOG ERROR
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli '/home/piotr/.nvm/versions/node/v12.18.3/bin/node',
1 verbose cli '/home/piotr/.nvm/versions/node/v12.18.3/bin/npm',
1 verbose cli 'run',
1 verbose cli 'prefix:css'
1 verbose cli ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prefix:css' ]
5 info lifecycle [email protected]~prefix:css: [email protected]
6 verbose lifecycle [email protected]~prefix:css: unsafe-perm in lifecycle true
7 verbose lifecycle [email protected]~prefix:css: PATH: /home/piotr/.nvm/versions/node/v12.18.3/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/piotr/Documents/personal/ProgrammingBooks/HTML, CSS/advanced-css-course-master/Natours/starter/node_modules/.bin:/home/piotr/.nvm/versions/node/v12.18.3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
8 verbose lifecycle [email protected]~prefix:css: CWD: /home/piotr/Documents/personal/ProgrammingBooks/HTML, CSS/advanced-css-course-master/Natours/starter
9 silly lifecycle [email protected]~prefix:css: Args: [
9 silly lifecycle '-c',
9 silly lifecycle "postcss --use autoprefixer -b 'last ten versions' css/style.concat.css -o css/style.prefix.css"
9 silly lifecycle ]
10 silly lifecycle [email protected]~prefix:css: Returned: code: 1 signal: null
11 info lifecycle [email protected]~prefix:css: Failed to exec prefix:css script
12 verbose stack Error: [email protected] prefix:css: `postcss --use autoprefixer -b 'last ten versions' css/style.concat.css -o css/style.prefix.css`
12 verbose stack Exit status 1
12 verbose stack at EventEmitter.<anonymous> (/home/piotr/.nvm/versions/node/v12.18.3/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
12 verbose stack at EventEmitter.emit (events.js:315:20)
12 verbose stack at ChildProcess.<anonymous> (/home/piotr/.nvm/versions/node/v12.18.3/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
12 verbose stack at ChildProcess.emit (events.js:315:20)
12 verbose stack at maybeClose (internal/child_process.js:1021:16)
12 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
13 verbose pkgid [email protected]
14 verbose cwd /home/piotr/Documents/personal/ProgrammingBooks/HTML, CSS/advanced-css-course-master/Natours/starter
15 verbose Linux 5.4.0-47-generic
16 verbose argv "/home/piotr/.nvm/versions/node/v12.18.3/bin/node" "/home/piotr/.nvm/versions/node/v12.18.3/bin/npm" "run" "prefix:css"
17 verbose node v12.18.3
18 verbose npm v6.14.8
19 error code ELIFECYCLE
20 error errno 1
21 error [email protected] prefix:css: `postcss --use autoprefixer -b 'last ten versions' css/style.concat.css -o css/style.prefix.css`
21 error Exit status 1
22 error Failed at the [email protected] prefix:css script.
22 error This is probably not a problem with npm. There is likely additional logging output above.
23 verbose exit [ 1, true ]
Upvotes: 2
Views: 2312
Reputation: 3976
I ran into a similar issue - there seems to be some bugs with autoprefixer version 10.0.0.
Downgrade your autoprefixer vesion and your command will run as expected.
Change "autoprefixer": "^10.0.0",
to "autoprefixer": "<10.0.0",
in your package file. This will install the newest version of autoprefixer that is less than version 10.0.0 - reference.
Upvotes: 3