I'm trying to clean up my css and use UnCSS with gulp and Postcss.
I have this:
gulp.task('optim-css', function() {
var stream1 = gulp.src(['dev/css/bootstrap.min.css','dev/css/custom.css'])
.pipe(postcss([ rucksack() ]))
.pipe(postcss(uncss({
html: ['http://localhost/olssonseder/','http://localhost/olssonseder/lyssna/','http://localhost/olssonseder/repertoar/','http://localhost/olssonseder/kontakta/','http://localhost/olssonseder/kontakta/','http://localhost/olssonseder/om-gitarren/'],
ignore: [new RegExp('.b-lazy*'),
new RegExp('.stickyFooter')]
}))
);
var stream2 = gulp.src(['dev/css/responsive-nav.css','dev/css/lity.css','dev/css/mp3-player-button.css'])
return merge(stream1, stream2)
.pipe(concat('styles.css'))
.pipe(cleanCSS())
.pipe(gulp.dest(''))
.pipe(browserSync.stream());
});
But I get this error and I just can't figure out why:
[14:21:49] TypeError: UnCSS: expected a callback
at init (C:\Users\Nicke\Documents\PortableApps\UwAmp\www\olssonseder\wp-content\themes\bastema\node_modules\uncss\src\uncss.js:176:15)
at Gulp.<anonymous> (C:\Users\Nicke\Documents\PortableApps\UwAmp\www\olssonseder\wp-content\themes\bastema\gulpfile.js:48:23)
at module.exports (C:\Users\Nicke\Documents\PortableApps\UwAmp\www\olssonseder\wp-content\themes\bastema\node_modules\orchestrator\lib\runTask.js:34:7)
at Gulp.Orchestrator._runTask (C:\Users\Nicke\Documents\PortableApps\UwAmp\www\olssonseder\wp-content\themes\bastema\node_modules\orchestrator\index.js:273:3)
at Gulp.Orchestrator._runStep (C:\Users\Nicke\Documents\PortableApps\UwAmp\www\olssonseder\wp-content\themes\bastema\node_modules\orchestrator\index.js:214:10)
at Gulp.Orchestrator.start (C:\Users\Nicke\Documents\PortableApps\UwAmp\www\olssonseder\wp-content\themes\bastema\node_modules\orchestrator\index.js:134:8)
at C:\Users\Nicke\Documents\PortableApps\UwAmp\www\olssonseder\wp-content\themes\bastema\node_modules\gulp\bin\gulp.js:129:20
at process._tickCallback (internal/process/next_tick.js:150:11)
at Function.Module.runMain (module.js:703:11)
at startup (bootstrap_node.js:190:16)
[14:21:52] Finished 'optim-js' after 2.75 s
[14:21:52] Finished 'optim-deferjs' after 2.73 s
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! bastema#1.0.0 gi: `gulp init`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the bastema#1.0.0 gi 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! C:\Users\Nicke\AppData\Roaming\npm-cache\_logs\2018-07-27T12_21_52_508Z-debug.log
Anyone has an idea as to why this is happening?
I ran into the same problem. After creating a callback and running into other problems, I found that uncss could not be used directly with postcss. Use postcss-uncss instead and it works as expected.
From: https://github.com/uncss/uncss
Note: Depending on your environment, you might not be able to use
uncss as a PostCSS plugin since the plugin is not directly exported.
In such cases, use the wrapper library postcss-uncss.
Here is the postcss-uncss library: https://github.com/uncss/postcss-uncss
Related
I implemented my vue application with i18n and it worked all fine yesterday. But when I tried to start my application today I got the error which you can see in the title. I can give the following stack trace:
TypeError: Cannot read property 'i18n' of undefined
at module.exports (..\node_modules\vue-cli-plugin-i18n\index.js:4:49)
at ..\node_modules\#vue\cli-service\lib\Service.js:93:7
at Array.forEach (<anonymous>)
at Service.init (..\node_modules\#vue\cli-service\lib\Service.js:91:18)
at Service.run (..\node_modules\#vue\cli-service\lib\Service.js:230:10)
at Object.<anonymous> (..\node_modules\#vue\cli-service\bin\vue-cli-service.js:36:9)
at Module._compile (internal/modules/cjs/loader.js:1133:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
at Module.load (internal/modules/cjs/loader.js:977:32)
at Function.Module._load (internal/modules/cjs/loader.js:877:14)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! <Projectname>#0.1.0 serve: `vue-cli-service serve`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the <Projectname>#0.1.0 serve script.
(I took out my paths and replaced them with "..")
I really can't explain, why I get this error now. Because yesterday I also had to restart the server and it worked all fine..
I also took out every line of code in which I use something like
$i18n.locale
(Except for the routing and code in the index.js etc.) But that didn't work for me too.
And I deleted the node_module folder as well and installed everything again but this didn't work.
If you need any information please tell me.
I'm pretty new to vue.js but I'm facing a similar issue (same stack trace).
Here is what I have found hoping it can help you :
Adding a file vue.config.js at the root of the project with :
module.exports = {
pluginOptions: {
i18n: {
locale: 'fr',
fallbackLocale: 'en',
localeDir: 'assets/locales',
enableInSFC: true
}
}
}
seems to resolve the compilation issue (no clue if it's the right solution, I'm still searching).
What I have done to find this is vue add i18 then remove file/modification one by one util the compilation error came back.
Recently I've set up Slate using these steps to work on my Shopify themes locally. It worked fine, but after a while i got an error when attempting to npm start Slate in the terminal.
I've tried updating npm and node and they are both the latest version.
This is the error I get in the terminal:
starter-theme#1.0.0-alpha.1 start path-to-project
slate-tools start
WebpackOptionsValidationError: Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
- configuration.entry should be an non-empty object.
-> Multiple entry bundles are created. The key is the chunk name. The value can be a string or an array.
at webpack (path-to-project-folder/node_modules/webpack/lib/webpack.js:31:9)
at new DevServer (path-to-project-folder/node_modules/#shopify/slate-tools/tools/asset-server/index.js:21:21)
at path-to-project-folder/node_modules/#shopify/slate-tools/cli/commands/start.js:48:19
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! starter-theme#1.0.0-alpha.1 start: `slate-tools start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the starter-theme#1.0.0-alpha.1 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
This is the slate.config.js file:
/* eslint-disable */
// Configuration file for all things Slate.
// For more information, visit https://github.com/Shopify/slate/wiki/Slate-Configuration
const path = require('path');
module.exports = {
'cssVarLoader.liquidPath': ['src/snippets/css-variables.liquid'],
'webpack.extend': {
resolve: {
alias: {
jquery: path.resolve('./node_modules/jquery'),
'lodash-es': path.resolve('./node_modules/lodash-es'),
},
},
},
};
Has anyone run into this issue before, how did you fix it?
I have Vue application that I don't run for a while and now I cannot start development server?! In meanwhile something updated and that don't work. I tried new clean vue/vuetify install and same problem!
Build for production works normally, only run development server don't work.
And important notice: when run "npm run serve" in command prompt (outside VS Code), it works normally. That not work only in VS Code Terminal. What is problem?
Node version is v10.16.0
Npm version is 6.10.3
VS Code About:
Commit: 036a6b1d3ac84e5ca96a17a44e63a87971f8fcc8
Date: 2019-08-08T02:33:50.993Z
Electron: 4.2.7
Chrome: 69.0.3497.128
Node.js: 10.11.0
V8: 6.9.427.31-electron.0
OS: Windows_NT x64 10.0.17763
Error (from terminal window):
> Executing task: npm run serve <
> portal#0.1.0 serve d:\Wamp64\www\portal
> vue-cli-service serve
INFO Starting development server...
10% building 2/2 modules 0 active ERROR Error: Watching remote files is not supported.
Error: Watching remote files is not supported.
at Server.setupWatchStaticFeature (d:\Wamp64\www\portal\node_modules\webpack-dev-server\lib\Server.js:405:13)
at Object.watchContentBase (d:\Wamp64\www\portal\node_modules\webpack-dev-server\lib\Server.js:477:14)
at forEach (d:\Wamp64\www\portal\node_modules\webpack-dev-server\lib\Server.js:550:24)
at Array.forEach (<anonymous>)
at Server.setupFeatures (d:\Wamp64\www\portal\node_modules\webpack-dev-server\lib\Server.js:549:49)
at new Server (d:\Wamp64\www\portal\node_modules\webpack-dev-server\lib\Server.js:125:10)
at serve (d:\Wamp64\www\portal\node_modules\#vue\cli-service\lib\commands\serve.js:139:20)
at process._tickCallback (internal/process/next_tick.js:68:7)
at Function.Module.runMain (internal/modules/cjs/loader.js:832:11)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! portal#0.1.0 serve: `vue-cli-service serve`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the portal#0.1.0 serve 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! C:\Users\Sasa Gosovic\AppData\Roaming\npm-cache\_logs\2019-08-11T10_35_40_418Z-debug.log
The terminal process terminated with exit code: 1
Press any key to close the terminal.
Exactly the same issue here. I resolved it by rolling back the version of webpack-dev-server.
npm install webpack-dev-server#3.7.2 --save-dev
Looks like the setupWatchStaticFeature function has changed between 3.7.2 and 3.8.0 which is triggering the issue.
You can eddit the vue.config.js file, adding following code:
devServer: {
contentBase: './public'
}
More details: https://github.com/webpack/webpack-dev-server/issues/2190#issuecomment-520670599
Until the issue is open, a workaround could be to use Git Bash instead of Windows command line to run npm run serve. I modified Server.js to output the contentBase variable. When using Windows command line or Vue UI, the variable contained "c:\...". Using Git Bash on my Windows 10 machine it contains "C:\..." and it worked.
I am trying to update Cypress to the latest version using the following provided command:
npm install --save-dev cypress#3.2.0
In previous versions this has worked fine with no errors. Now, when I run this, I keep getting the following error:
Unhandled rejection Error: invalid config key requested: agentn 099cbf610e4ce787
at BadKeyError (/usr/local/lib/node_modules/npm/node_modules/figgy-pudding/index.js:93:23)
at pudGet (/usr/local/lib/node_modules/npm/node_modules/figgy-pudding/index.js:101:5)
at FiggyPudding.get (/usr/local/lib/node_modules/npm/node_modules/figgy-pudding/index.js:27:12)
at Object.get (/usr/local/lib/node_modules/npm/node_modules/figgy-pudding/index.js:159:16)
at new PacoteOptions (/usr/local/lib/node_modules/npm/node_modules/pacote/lib/util/opt-check.js:9:21)
at optCheck (/usr/local/lib/node_modules/npm/node_modules/pacote/lib/util/opt-check.js:63:10)
at Object.manifest (/usr/local/lib/node_modules/npm/node_modules/pacote/manifest.js:11:10)
at fetchPackageMetadata (/usr/local/lib/node_modules/npm/lib/fetch-package-metadata.js:58:10)
at limited (/usr/local/lib/node_modules/npm/node_modules/call-limit/call-limit.js:29:10)
at /usr/local/lib/node_modules/npm/lib/install/deps.js:235:14
at /usr/local/lib/node_modules/npm/node_modules/slide/lib/async-map.js:52:35
at Array.forEach (<anonymous>)
at /usr/local/lib/node_modules/npm/node_modules/slide/lib/async-map.js:52:11
at Array.forEach (<anonymous>)
at asyncMap (/usr/local/lib/node_modules/npm/node_modules/slide/lib/async-map.js:51:8)
at exports.getAllMetadata (/usr/local/lib/node_modules/npm/lib/install/deps.js:206:3)
npm ERR! cb() never called!
npm ERR! This is an error with npm itself. Please report this error at:
npm ERR! <https://npm.community>
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/jaswindersingh/.npm/_logs/2019-03-15T13_32_13_190Z-debug.log
Could anyone point me to what this means and how I can fix it?
Never seen this kind of error before?
And as far as I know I've not made any changes to any of my packages in either package.json or package-lock.json etc (from what I have read so far from similar posts)
I think this is an npm issue.
Try to delete package-lock.json and run your command again. This should solve your problem.
Also, if you can, try to upgrade your npm version, since this issue is marked as closed in npm repository.
It is really npm issue. Try to change version to some up-to-date one. If there is some problems with it, you can use nvm.
In my case I`ve changed node version 10.8.0 to 12.18.3 and npm as well.
When I npm run build in my Vue.js project, I get bellow error:
ERROR in ./src/vendors.js
Module build failed: SyntaxError: /home/ldl/repo/vue_admin_site/.babelrc: Error while parsing JSON - Unexpected EOF at line 1 column 2 of the JSON5 data. Still to read: ""
at error (/home/ldl/repo/vue_admin_site/node_modules/json5/lib/json5.js:56:25)
at word (/home/ldl/repo/vue_admin_site/node_modules/json5/lib/json5.js:393:13)
at value (/home/ldl/repo/vue_admin_site/node_modules/json5/lib/json5.js:493:56)
at Object.parse (/home/ldl/repo/vue_admin_site/node_modules/json5/lib/json5.js:508:18)
at ConfigChainBuilder.addConfig (/home/ldl/repo/vue_admin_site/node_modules/babel-core/lib/transformation/file/options/build-config-chain.js:150:65)
at ConfigChainBuilder.findConfigs (/home/ldl/repo/vue_admin_site/node_modules/babel-core/lib/transformation/file/options/build-config-chain.js:96:16)
at buildConfigChain (/home/ldl/repo/vue_admin_site/node_modules/babel-core/lib/transformation/file/options/build-config-chain.js:61:13)
at OptionManager.init (/home/ldl/repo/vue_admin_site/node_modules/babel-core/lib/transformation/file/options/option-manager.js:354:58)
at File.initOptions (/home/ldl/repo/vue_admin_site/node_modules/babel-core/lib/transformation/file/index.js:212:65)
at new File (/home/ldl/repo/vue_admin_site/node_modules/babel-core/lib/transformation/file/index.js:135:24)
at Pipeline.transform (/home/ldl/repo/vue_admin_site/node_modules/babel-core/lib/transformation/pipeline.js:46:16)
at transpile (/home/ldl/repo/vue_admin_site/node_modules/babel-loader/lib/index.js:46:20)
at Object.module.exports (/home/ldl/repo/vue_admin_site/node_modules/babel-loader/lib/index.js:163:20)
ERROR in ./src/main.js
Module build failed: SyntaxError: /home/ldl/repo/vue_admin_site/.babelrc: Error while parsing JSON - Unexpected EOF at line 1 column 2 of the JSON5 data. Still to read: ""
at error (/home/ldl/repo/vue_admin_site/node_modules/json5/lib/json5.js:56:25)
at word (/home/ldl/repo/vue_admin_site/node_modules/json5/lib/json5.js:393:13)
at value (/home/ldl/repo/vue_admin_site/node_modules/json5/lib/json5.js:493:56)
at Object.parse (/home/ldl/repo/vue_admin_site/node_modules/json5/lib/json5.js:508:18)
at ConfigChainBuilder.addConfig (/home/ldl/repo/vue_admin_site/node_modules/babel-core/lib/transformation/file/options/build-config-chain.js:150:65)
at ConfigChainBuilder.findConfigs (/home/ldl/repo/vue_admin_site/node_modules/babel-core/lib/transformation/file/options/build-config-chain.js:96:16)
at buildConfigChain (/home/ldl/repo/vue_admin_site/node_modules/babel-core/lib/transformation/file/options/build-config-chain.js:61:13)
at OptionManager.init (/home/ldl/repo/vue_admin_site/node_modules/babel-core/lib/transformation/file/options/option-manager.js:354:58)
at File.initOptions (/home/ldl/repo/vue_admin_site/node_modules/babel-core/lib/transformation/file/index.js:212:65)
at new File (/home/ldl/repo/vue_admin_site/node_modules/babel-core/lib/transformation/file/index.js:135:24)
at Pipeline.transform (/home/ldl/repo/vue_admin_site/node_modules/babel-core/lib/transformation/pipeline.js:46:16)
at transpile (/home/ldl/repo/vue_admin_site/node_modules/babel-loader/lib/index.js:46:20)
at Object.module.exports (/home/ldl/repo/vue_admin_site/node_modules/babel-loader/lib/index.js:163:20)
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! iview-admin#1.1.4 build: `webpack --progress --hide-modules --config build/webpack.prod.config.js`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the iview-admin#1.1.4 build 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/ldl/.npm/_logs/2018-05-10T23_56_56_191Z-debug.log
How to solve this issue?
I find the .babelrc file in my project.
/home/ldl/repo/vue_admin_site/.babelrc
/home/ldl/repo/vue_admin_site/node_modules/estraverse/.babelrc
/home/ldl/repo/vue_admin_site/node_modules/esrecurse/.babelrc
/home/ldl/repo/vue_admin_site/node_modules/localforage/.babelrc
/home/ldl/repo/vue_admin_site/node_modules/escope/.babelrc
/home/ldl/repo/vue_admin_site/node_modules/postcss-discard-overridden/.babelrc
/home/ldl/repo/vue_admin_site/node_modules/iview-area/.babelrc
/home/ldl/repo/vue_admin_site/node_modules/mavon-editor/.babelrc
You .babelrc file seems to be saved in some other encoding than 'UTF8'. You can change the encoding of your file using notepad++ or download any existing .babelrc file from any project and change according to your need.