WPGulp icon indicating copy to clipboard operation
WPGulp copied to clipboard

npm start fails when implementing it on existing theme

Open kumaillakhani opened this issue 5 years ago • 3 comments

My wpgulp.config.js file

/**
 * WPGulp Configuration File
 *
 * 1. Edit the variables as per your project requirements.
 * 2. In paths you can add <<glob or array of globs>>.
 *
 * @package WPGulp
 */

module.exports = {

	// Project options.
	projectURL: 'http://wptest1.local', // Local project URL of your already running WordPress site. Could be something like wpgulp.local or localhost:3000 depending upon your local WordPress setup.
	productURL: './', // Theme/Plugin URL. Leave it like it is, since our gulpfile.js lives in the root folder.
	browserAutoOpen: false,
	injectChanges: true,

	// Style options.
	styleSRC: './css/style.css', // Path to main .scss file.
	styleDestination: './', // Path to place the compiled CSS file. Default set to root folder.
	outputStyle: 'compact', // Available options → 'compact' or 'compressed' or 'nested' or 'expanded'
	errLogToConsole: true,
	precision: 10,

	// JS Vendor options.
	jsVendorSRC: './js/*.js', // Path to JS vendor folder.
	jsVendorDestination: './assets/js/', // Path to place the compiled JS vendors file.
	jsVendorFile: 'vendor', // Compiled JS vendors file name. Default set to vendors i.e. vendors.js.

	// JS Custom options.
	jsCustomSRC: './js/custom/*.js', // Path to JS custom scripts folder.
	jsCustomDestination: './assets/js/', // Path to place the compiled JS custom scripts file.
	jsCustomFile: 'custom', // Compiled JS custom file name. Default set to custom i.e. custom.js.

	// Images options.
	imgSRC: './images/**/*', // Source folder of images which should be optimized and watched. You can also specify types e.g. raw/**.{png,jpg,gif} in the glob.
	imgDST: './assets/img/', // Destination folder of optimized images. Must be different from the imagesSRC folder.

	// Watch files paths.
	watchStyles: './css/**/*.scss', // Path to all *.scss files inside css folder and inside them.
	watchJsVendor: './js/*.js', // Path to all vendor JS files.
	watchJsCustom: './js/custom/*.js', // Path to all custom JS files.
	watchPhp: './**/*.php', // Path to all PHP files.

	// Translation options.
	textDomain: 'WPGULP', // Your textdomain here.
	translationFile: 'WPGULP.pot', // Name of the translation file.
	translationDestination: './languages', // Where to save the translation files.
	packageName: 'WPGULP', // Package name.
	bugReport: 'https://AhmadAwais.com/contact/', // Where can users report bugs.
	lastTranslator: 'Ahmad Awais <[email protected]>', // Last translator Email ID.
	team: 'AhmadAwais <[email protected]>', // Team's Email ID.

	// Browsers you care about for autoprefixing. Browserlist https://github.com/ai/browserslist
	// The following list is set as per WordPress requirements. Though, Feel free to change.
	BROWSERS_LIST: [
		'last 2 version',
		'> 1%',
		'ie >= 11',
		'last 1 Android versions',
		'last 1 ChromeAndroid versions',
		'last 2 Chrome versions',
		'last 2 Firefox versions',
		'last 2 Safari versions',
		'last 2 iOS versions',
		'last 2 Edge versions',
		'last 2 Opera versions'
	]
};

Terminal:

npm start

[email protected] start /Local Sites/wptest1/app/public/wp-content/themes/myTheme gulp

[20:59:16] Requiring external module @babel/register [20:59:38] Using gulpfile /Local Sites/wptest1/app/public/wp-content/themes/myTheme/gulpfile.babel.js [20:59:38] Starting 'default'... [20:59:38] Starting 'styles'... [20:59:38] Starting 'vendorsJS'... [20:59:38] Starting 'customJS'... [20:59:38] Starting 'images'... [20:59:38] Starting 'browsersync'... [20:59:38] Starting ''... [20:59:42] Finished 'browsersync' after 3.54 s [20:59:42] Finished 'customJS' after 3.63 s [Browsersync] Proxying: http://wptest1.local [Browsersync] Access URLs:

   Local: http://localhost:3000
External: http://192.168.8.100:3000

      UI: http://localhost:3001

UI External: http://localhost:3001

[20:59:51] 'styles' errored after 13 s [20:59:51] Error: missing '}' near line 5:25 at error (/Local Sites/wptest1/app/public/wp-content/themes/myTheme/node_modules/css-parse/index.js:57:15) at declarations (/Local Sites/wptest1/app/public/wp-content/themes/myTheme/node_modules/css-parse/index.js:224:26) at rule (/Local Sites/wptest1/app/public/wp-content/themes/myTheme/node_modules/css-parse/index.js:481:21) at rules (/Local Sites/wptest1/app/public/wp-content/themes/myTheme/node_modules/css-parse/index.js:103:56) at stylesheet (/Local Sites/wptest1/app/public/wp-content/themes/myTheme/node_modules/css-parse/index.js:73:16) at module.exports (/Local Sites/wptest1/app/public/wp-content/themes/myTheme/node_modules/css-parse/index.js:485:10) at Transform.transform [as _transform] (/Local Sites/wptest1/app/public/wp-content/themes/myTheme/node_modules/gulp-merge-media-queries/index.js:133:19) at Transform._read (/Local Sites/wptest1/app/public/wp-content/themes/myTheme/node_modules/gulp-merge-media-queries/node_modules/readable-stream/lib/_stream_transform.js:184:10) at Transform._write (/Local Sites/wptest1/app/public/wp-content/themes/myTheme/node_modules/gulp-merge-media-queries/node_modules/readable-stream/lib/_stream_transform.js:172:12) at doWrite (/Local Sites/wptest1/app/public/wp-content/themes/myTheme/node_modules/gulp-merge-media-queries/node_modules/readable-stream/lib/_stream_writable.js:237:10) at writeOrBuffer (/Local Sites/wptest1/app/public/wp-content/themes/myTheme/node_modules/gulp-merge-media-queries/node_modules/readable-stream/lib/_stream_writable.js:227:5) at Transform.Writable.write (/Local Sites/wptest1/app/public/wp-content/themes/myTheme/node_modules/gulp-merge-media-queries/node_modules/readable-stream/lib/_stream_writable.js:194:11) at StreamFilter.ondata (/Local Sites/wptest1/app/public/wp-content/themes/myTheme/node_modules/readable-stream/lib/_stream_readable.js:619:20) at StreamFilter.emit (events.js:210:5) at StreamFilter.EventEmitter.emit (domain.js:498:23) at addChunk (/Local Sites/wptest1/app/public/wp-content/themes/myTheme/node_modules/readable-stream/lib/_stream_readable.js:291:12) at readableAddChunk (/Local Sites/wptest1/app/public/wp-content/themes/myTheme/node_modules/readable-stream/lib/_stream_readable.js:278:11) at StreamFilter.Readable.push (/Local Sites/wptest1/app/public/wp-content/themes/myTheme/node_modules/readable-stream/lib/_stream_readable.js:245:10) at StreamFilter.Transform.push (/Local Sites/wptest1/app/public/wp-content/themes/myTheme/node_modules/readable-stream/lib/_stream_transform.js:148:32) at StreamFilterCallback (/Local Sites/wptest1/app/public/wp-content/themes/myTheme/node_modules/streamfilter/src/index.js:30:15) at streamfilter.objectMode (/Local Sites/wptest1/app/public/wp-content/themes/myTheme/node_modules/gulp-filter/index.js:33:3) at StreamFilter.streamFilterTransform [as _transform] (/Local Sites/wptest1/app/public/wp-content/themes/myTheme/node_modules/streamfilter/src/index.js:28:5) at StreamFilter.Transform._read (/Local Sites/wptest1/app/public/wp-content/themes/myTheme/node_modules/readable-stream/lib/_stream_transform.js:184:10) at StreamFilter.Transform._write (/Local Sites/wptest1/app/public/wp-content/themes/myTheme/node_modules/readable-stream/lib/_stream_transform.js:172:83) at doWrite (/Local Sites/wptest1/app/public/wp-content/themes/myTheme/node_modules/readable-stream/lib/_stream_writable.js:428:64) at writeOrBuffer (/Local Sites/wptest1/app/public/wp-content/themes/myTheme/node_modules/readable-stream/lib/_stream_writable.js:417:5) at StreamFilter.Writable.write (/Local Sites/wptest1/app/public/wp-content/themes/myTheme/node_modules/readable-stream/lib/_stream_writable.js:334:11) at Pumpify.ondata (/Local Sites/wptest1/app/public/wp-content/themes/myTheme/node_modules/readable-stream/lib/_stream_readable.js:619:20) at Pumpify.emit (events.js:215:7) at Pumpify.EventEmitter.emit (domain.js:498:23) at addChunk (/Local Sites/wptest1/app/public/wp-content/themes/myTheme/node_modules/readable-stream/lib/_stream_readable.js:291:12) at readableAddChunk (/Local Sites/wptest1/app/public/wp-content/themes/myTheme/node_modules/readable-stream/lib/_stream_readable.js:278:11) at Pumpify.Readable.push (/Local Sites/wptest1/app/public/wp-content/themes/myTheme/node_modules/readable-stream/lib/_stream_readable.js:245:10) at Pumpify.Duplexify.forward (/Local Sites/wptest1/app/public/wp-content/themes/myTheme/node_modules/duplexify/index.js:170:26) at DestroyableTransform.onreadable (/Local Sites/wptest1/app/public/wp-content/themes/myTheme/node_modules/duplexify/index.js:134:10) at DestroyableTransform.emit (events.js:210:5) at DestroyableTransform.EventEmitter.emit (domain.js:498:23) at emitReadable (/Local Sites/wptest1/app/public/wp-content/themes/myTheme/node_modules/readable-stream/lib/_stream_readable.js:504:10) at emitReadable (/Local Sites/wptest1/app/public/wp-content/themes/myTheme/node_modules/readable-stream/lib/_stream_readable.js:498:62) at addChunk (/Local Sites/wptest1/app/public/wp-content/themes/myTheme/node_modules/readable-stream/lib/_stream_readable.js:298:29) at readableAddChunk (/Local Sites/wptest1/app/public/wp-content/themes/myTheme/node_modules/readable-stream/lib/_stream_readable.js:278:11) at DestroyableTransform.Readable.push (/Local Sites/wptest1/app/public/wp-content/themes/myTheme/node_modules/readable-stream/lib/_stream_readable.js:245:10) at DestroyableTransform.Transform.push (/Local Sites/wptest1/app/public/wp-content/themes/myTheme/node_modules/readable-stream/lib/_stream_transform.js:148:32) at DestroyableTransform.afterTransform (/Local Sites/wptest1/app/public/wp-content/themes/myTheme/node_modules/readable-stream/lib/_stream_transform.js:91:10) at onWritten (/Local Sites/wptest1/app/public/wp-content/themes/myTheme/node_modules/vinyl-fs/lib/dest/write-contents/index.js:51:7) at onClosed (/Local Sites/wptest1/app/public/wp-content/themes/myTheme/node_modules/vinyl-fs/lib/file-operations.js:26:5) at /Local Sites/wptest1/app/public/wp-content/themes/myTheme/node_modules/graceful-fs/graceful-fs.js:57:14 at FSReqCallback.oncomplete (fs.js:146:23)

[20:59:51] 'default' errored after 13 s [20:59:51] The following tasks did not complete: vendorsJS, images, [20:59:51] Did you forget to signal async completion? npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! [email protected] start: gulp npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the [email protected] start 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! /Users/myUserName/.npm/_logs/2019-12-30T15_59_51_358Z-debug.log


Log file:

0 info it worked if it ends with ok 1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'start' ] 2 info using [email protected] 3 info using [email protected] 4 verbose run-script [ 'prestart', 'start', 'poststart' ] 5 info lifecycle [email protected]~prestart: [email protected] 6 info lifecycle [email protected]~start: [email protected] 7 verbose lifecycle [email protected]~start: unsafe-perm in lifecycle true 8 verbose lifecycle [email protected]~start: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Local Sites/wptest1/app/public/wp-content/themes/myTheme/node_modules/.bin:/Users/myUserName/.cargo/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin 9 verbose lifecycle [email protected]~start: CWD: /Local Sites/wptest1/app/public/wp-content/themes/myTheme 10 silly lifecycle [email protected]~start: Args: [ '-c', 'gulp' ] 11 silly lifecycle [email protected]~start: Returned: code: 1 signal: null 12 info lifecycle [email protected]~start: Failed to exec start script 13 verbose stack Error: [email protected] start: gulp 13 verbose stack Exit status 1 13 verbose stack at EventEmitter. (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16) 13 verbose stack at EventEmitter.emit (events.js:210:5) 13 verbose stack at ChildProcess. (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14) 13 verbose stack at ChildProcess.emit (events.js:210:5) 13 verbose stack at maybeClose (internal/child_process.js:1021:16) 13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5) 14 verbose pkgid [email protected] 15 verbose cwd /Local Sites/wptest1/app/public/wp-content/themes/myTheme 16 verbose Darwin 19.2.0 17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "start" 18 verbose node v12.14.0 19 verbose npm v6.13.4 20 error code ELIFECYCLE 21 error errno 1 22 error [email protected] start: gulp 22 error Exit status 1 23 error Failed at the [email protected] start script. 23 error This is probably not a problem with npm. There is likely additional logging output above. 24 verbose exit [ 1, true ]

kumaillakhani avatar Dec 30 '19 16:12 kumaillakhani

I have the same issue, did you find a solution yet?

vzRowan avatar Feb 15 '20 11:02 vzRowan

Same issue. Images and CSS compilation is working. When I put my path of JS files to compile, that's when the error message appears Did you forget to signal async completion?.

It seems to be a problem since Gulp4 that has to be resolved like this : https://stackoverflow.com/questions/36897877/gulp-error-the-following-tasks-did-not-complete-did-you-forget-to-signal-async#answer-36899424

multimedianj avatar Apr 03 '20 16:04 multimedianj

I commented all the task to see if I get the error again, it really seems that this task causes the error : gulp.watch( config.watchJsCustom, gulp.series( 'customJS', reload ) );

And it seems like in the task, this pipe is causing a problem :

.pipe(
			babel({
				presets: [
					[
						'@babel/preset-env', // Preset to compile your modern JS to ES5.
						{
							targets: { browsers: config.BROWSERS_LIST } // Target browser list to support.
						}
					]
				]
			})
		)

multimedianj avatar Apr 03 '20 16:04 multimedianj