Gulp build formatError - gulp + harpjs + gulp-gh-page + node - javascript

I'm working on a project based on :
https://github.com/superhighfives/charliegleason.com
Everything was working so great, and now i have a problem when i try to build the project using gulp build ...
The link to the img of the term error:
http://i.imgur.com/f1kPjLk.png
Error: 1
at formatError (/usr/local/lib/node_modules/gulp/bin/gulp.js:169:10)
at Gulp. (/usr/local/lib/node_modules/gulp/bin/gulp.js:195:15)
at Gulp.emit (events.js:107:17)
at Gulp.Orchestrator._emitTaskDone (/Users/qvoiriot/Documents/qvoiriot.github.io/node_modules/gulp/node_modules/orchestrator/index.js:264:8)
at /Users/qvoiriot/Documents/qvoiriot.github.io/node_modules/gulp/node_modules/orchestrator/index.js:275:23
at finish (/Users/qvoiriot/Documents/qvoiriot.github.io/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:21:8)
at ChildProcess.cb (/Users/qvoiriot/Documents/qvoiriot.github.io/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:29:3)
at ChildProcess.emit (events.js:129:20)
at maybeClose (child_process.js:1015:16)
at Socket. (child_process.js:1183:11)
at Socket.emit (events.js:107:17)
at Pipe.close (net.js:485:12)
The build process is the same that you can see in the link below. For the build part :
gulp.task('build', function (done) {
cp.exec('harp compile . dist', {stdio: 'inherit'})
.on('close', done)
});
If anybody have an idea about the way i can fix this ... ???
Thanks,
Q

I ran into the same error with a Gulp/Harp setup after installing nvm. I fixed it by re-installing Harp.js globally.
npm install -g harp

Related

Electron NodeJS spawn error when running certain commands: spawn ENOENT

So, I'm trying to use spawn in my Electron application to run the flutter --version command.
This command works perfectly fine on my terminal.
Every solution I've seen implies I don't have it in my process.env.PATH variable. But when I do a console.log( process.env.PATH );, the path to my Flutter command is there.
Here is the current code I'm trying to execute:
const flutterVer = spawn('flutter', ['--version', '/c']);
flutterVer.stdout.on('data', (data) => {
console.log(`stdout: ${data}`);
});
Which returns:
Uncaught Error: spawn flutter ENOENT
at __node_internal_captureLargerStackTrace (node:internal/errors:464:5)
at __node_internal_errnoException (node:internal/errors:594:12)
at Process.ChildProcess._handle.onexit (node:internal/child_process:282:19)
at onErrorNT (node:internal/child_process:477:16)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
I tried testing with another command, like git --version, and that worked perfectly fine.
I've found a neat workaround by using exec instead of spawn like so.
const { exec } = require('child_process');
const flutterVer = exec('flutter --version');
flutterVer.stdout.on('data', (data) => {
console.log(`stdout: ${data}`);
});
Will have too look into what the differences are between exec and spawn, but for now, it does what I need.

Cannot run Parcel in my project (Parcel does not create dist with compiled file)

Please help me figure out the problem. I can not understand the essence of the error and how to fix it.
I initialize the project: npm init -y
Install Parcel: npm install --save-dev parcel
I create src directory with an index.html file.
When I run the npx parcel src/index.html command, I get an error:
Error: The filename, directory name, or volume label syntax is incorrect.
at Object.open (C:\Users\dell\OneDrive\Документи\Projects\Test\node_modules\lmdb\dist\index.cjs:1936:3)
at new LMDBCache (C:\Users\dell\OneDrive\Документи\Projects\Test\node_modules#parcel\cache\lib\LMDBCache.js:69:34)
at resolveOptions (C:\Users\dell\OneDrive\Документи\Projects\Test\node_modules#parcel\core\lib\resolveOptions.js:112:168)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async Parcel._init (C:\Users\dell\OneDrive\Документи\Projects\Test\node_modules#parcel\core\lib\Parcel.js:218:27)
at async Parcel.watch (C:\Users\dell\OneDrive\Документи\Projects\Test\node_modules#parcel\core\lib\Parcel.js:315:7)
at async run (C:\Users\dell\OneDrive\Документи\Projects\Test\node_modules\parcel\lib\cli.js:349:9) {
code: 123 }
I had the same issue. I resolved it by changing the line at node_modules#parcel\core\lib\resolveOptions.js:112:168 to
let cache = (_initialOptions$cache = initialOptions.cache) !== null && _initialOptions$cache !== void 0 ? _initialOptions$cache : new (_cache().FSCache)(outputFS, cacheDir);
Basically, I removed the
outputFS instanceof _fs().NodeFS ? new (_cache().LMDBCache)(cacheDir) : part of that line. For some unknown reason, there seems to be a problem with LMDBCache and Parcel.
You're missing the build command from npx parcel src/index.html:
Update to:
npx parcel build src/index.html.

Optipng Module build failed: Error: spawn

I've been looking the whole day to fix my issue.
My stack:
- node 8.1.3
- yarn 1.9.4
- mac os x 10.13.6
In my package.json I have following dependency:
"image-webpack-loader": "4.3.1",
This helps to load images in local webserver.
when I try to run 'yarn dev' to start the local webserver I get:
ERROR in ./src/assets/avatar.png Module build failed: Error: spawn
/Users/pieter/projecten/react-redux-donderstarter-test/node_modules/optipng-bin/vendor/optipng
ENOENT
at exports._errnoException (util.js:1022:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:189:19)
at onErrorNT (internal/child_process.js:366:16)
at _combinedTickCallback (internal/process/next_tick.js:102:11)
at process._tickCallback (internal/process/next_tick.js:161:9) # ./src/containers/HomePage/index.js 7:0-42 32:59-62 #
./src/containers/App/routes.js # ./src/containers/App/App.js #
./src/containers/App/index.js # ./src/index.js # multi
(webpack)-dev-server/client?http://0.0.0.0:9001 webpack/hot/dev-server
./src/index.js
So I've been reading lots of different 'solutions' and so I tried 'npm rebuild'
Output when I do 'npm rebuild':
optipng-bin#3.1.4 postinstall /Users/pieter/projecten/react-redux-donderstarter-test/node_modules/optipng-bin
node lib/install.js
⚠ unable to verify the first certificate ⚠ optipng pre-build test
failed ℹ compiling from source ✖ Error: ./configure
--with-system-zlib --prefix="/Users/pieter/projecten/react-redux-donderstarter-test/node_modules/optipng-bin/vendor"
--bindir="/Users/pieter/projecten/react-redux-donderstarter-test/node_modules/optipng-bin/vendor"
&& make install Command failed: make install pngrtran.c:98:1: warning:
unused function 'png_rtran_ok' [-Wunused-function]
png_rtran_ok(png_structrp png_ptr, int need_IHDR) ^ 1 warning
generated. /Library/Developer/CommandLineTools/usr/bin/ranlib: file:
libpng.a(pngpread.o) has no symbols
/Library/Developer/CommandLineTools/usr/bin/ranlib: file:
libpng.a(pngwtran.o) has no symbols
/Library/Developer/CommandLineTools/usr/bin/ranlib: file:
libpng.a(pngpread.o) has no symbols
/Library/Developer/CommandLineTools/usr/bin/ranlib: file:
libpng.a(pngwtran.o) has no symbols pngxmem.c:37:32: warning: result
of comparison of constant 2305843009213693951 with expression of type
'png_uint_32' (aka 'unsigned int') is always false
[-Wtautological-constant-out-of-range-compare] if (row_size == 0 ||
height > (pngx_alloc_size_t)(-1) / sizeof(png_bytep))
~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 warning generated.
/Library/Developer/CommandLineTools/usr/bin/ranlib: file:
libpngxtern.a(pngxio.o) has no symbols
/Library/Developer/CommandLineTools/usr/bin/ranlib: file:
libpngxtern.a(pngxio.o) has no symbols osys.c:515:25: error: no member
named 'st_atim' in 'struct stat'
times[0] = sbuf.st_atim;
~~~~ ^ osys.c:516:25: error: no member named 'st_mtim' in 'struct stat'
times[1] = sbuf.st_mtim;
~~~~ ^ 2 errors generated. make[1]: * [osys.o] Error 1 make: * [install] Error 2
at ChildProcess.exithandler (child_process.js:270:12)
at emitTwo (events.js:125:13)
at ChildProcess.emit (events.js:213:7)
at maybeClose (internal/child_process.js:897:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:208:5)
I've been googling on the error and I found:
https://sourceforge.net/p/optipng/bugs/68/
and appearently there's been a fix: https://github.com/macports/macports-ports/commit/f69d413bbcc4ed122933757146168c5103e6039f
I have no idea on how to proceed from here, to make my local situation work.
How to fix this annoying error? i'm really really stuck so any help would be greatly appreciated!

Error: spawn npm ENOENT

I have an JS app. It works good on linux but in windows 10 I am getting an error.
events.js:161
throw er; // Unhandled 'error' event
^
Error: spawn npm ENOENT
at exports._errnoException (util.js:1028:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32)
at onErrorNT (internal/child_process.js:359:16)
at _combinedTickCallback (internal/process/next_tick.js:74:11)
at process._tickCallback (internal/process/next_tick.js:98:9)
at Module.runMain (module.js:607:11)
at run (bootstrap_node.js:422:7)
at startup (bootstrap_node.js:143:9)
at bootstrap_node.js:537:3
and the code which is incorrect is this
const spawn = require('child_process').spawn;
const watching = [
// {service: "babel-watch"},
{service: "webpack-watch"},
// {service: "sass-watch"},
{service: "server-watch"}
];
watching.forEach(({service}) => {
const child = spawn('npm', ['run', service]);
child.stdout.on('data', d => console.log(d.toString()));
child.stderr.on('data', d => console.log(d.toString()));
});
I found the reason of this error in github I guess the problem is spawn nodejs spawn Doc which have didn't work correctly in windows. But I don't know how to modify this snippet of code to make it work. Can someone help me ?
Just changed this line
const child = spawn('npm', ['run', service]);
to this line
const child = spawn(/^win/.test(process.platform) ? 'npm.cmd' : 'npm', ['run', service]);
Which is checking the operating system if ti's windows it runs npm.cmd if it's linux just npm
I know there is a correct answer and this question has been around for a long time, my solution is based on the answer #Armen Sanoyan and How do I determine the current operating system with Node.js
For me the #Armen Sanoyan answer does not work, but help a lot. I changed for this line and work.
const child = (process.platform === 'win32' ? 'npm.cmd' : 'npm') + ' run ' + service;
I hope I can help.
I faced the same problem. My application code was running fine in MAC but in Windows it was giving an error about the code related to the spawn command
The error occurs when running using command prompt
When I used GIT bash to start the application then the error did not occur. I did not need to change any code
I know this seems obvious but make sure you're not putting several flags/options into a single string:
// do not do this
spawn('pnpm', ['-r', 'exec', '--', 'pnpm version patch'])
// do this
spawn('pnpm', ['-r', 'exec', '--', 'pnpm', 'version', 'patch'])

using series and parallel tasks in gulp 4.0

I am trying to manipulate text before a file is sent to browserify, and I am attempting to use gulp.series to do this. Here's how:
gulp.task('dev_urls', function() {
gulp.src([ 'app/index.js' ])
.pipe(...)
.pipe(gulp.dest(...))
gulp.task('build_dev',
gulp.series('dev_urls', 'browserify', gulp.parallel('copy')))
When I execute the build_dev task using gulp build_dev from the command line, I am given this error:
/usr/local/lib/node_modules/gulp/bin/gulp.js:121
gulpInst.start.apply(gulpInst, toRun);
^
TypeError: Cannot read property 'apply' of undefined
at /usr/local/lib/node_modules/gulp/bin/gulp.js:121:19
at doNTCallback0 (node.js:407:9)
at process._tickDomainCallback (node.js:377:13)
at Function.Module.runMain (module.js:477:11)
at startup (node.js:117:18)
at node.js:951:3
How can I get this to work?
EDIT:
I am getting that same error with this file:
var gulp = require('gulp');
gulp.task('build_dev', function() {
console.log(1);
})
You need to return from your function.
gulp.task('dev_urls', function() {
return gulp.src([ 'app/index.js' ])
.pipe()
}
Also make sure that gulp is installed correctly.
$ sudo rm /usr/local/bin/gulp
$ sudo rm -rf /usr/local/lib/node_modules/gulp
$ npm uninstall gulp
$ npm install gulpjs/gulp-cli#4.0 -g
# install Gulp 4 into your project
$ npm install gulpjs/gulp.git#4.0 --save-dev

Categories

Resources