Skip to main content
3 de 4
se añadieron 844 caracteres en el cuerpo

Error con script imagemin en NPM

Estoy aprendiendo cómo crear una carpeta de distribución que contenga los archivos que se pueden implementar en un servidor web que aloja su proyecto. Esta carpeta de distribución se compilará a partir de los archivos de su proyecto utilizando varios paquetes y scripts de NPM.

Sin embargo cuando intento ejecutar el commando npm run build obtengo errores con imagemin img/* -o dist/img

El codigo de la pagina esta sobre Bitbucket

mike@mike-thinks:~/Bootstrap4/conFusion$ sudo npm run build

> [email protected] build /home/mike/Bootstrap4/conFusion
> npm run clean && npm run imagemin && npm run copyfonts && npm run usemin


> [email protected] clean /home/mike/Bootstrap4/conFusion
> rimraf dist


> [email protected] imagemin /home/mike/Bootstrap4/conFusion
> imagemin img/* -o dist/img

Error: Error in file: img/logo.png

spawn /usr/local/lib/node_modules/imagemin-cli/node_modules/optipng-bin/vendor/optipng ENOENT
    at exports._errnoException (util.js:870:11)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:178:32)
    at onErrorNT (internal/child_process.js:344:16)
    at nextTickCallbackWith2Args (node.js:441:9)
    at process._tickCallback (node.js:355:17)

npm ERR! Linux 4.10.0-42-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "run" "imagemin"
npm ERR! node v4.2.6
npm ERR! npm  v3.5.2
npm ERR! code ELIFECYCLE
npm ERR! [email protected] imagemin: `imagemin img/* -o dist/img`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] imagemin script 'imagemin img/* -o dist/img'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the confusion package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     imagemin img/* -o dist/img
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs confusion
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls confusion
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/mike/Bootstrap4/conFusion/npm-debug.log

npm ERR! Linux 4.10.0-42-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "run" "build"
npm ERR! node v4.2.6
npm ERR! npm  v3.5.2
npm ERR! code ELIFECYCLE
npm ERR! [email protected] build: `npm run clean && npm run imagemin && npm run copyfonts && npm run usemin`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] build script 'npm run clean && npm run imagemin && npm run copyfonts && npm run usemin'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the confusion package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     npm run clean && npm run imagemin && npm run copyfonts && npm run usemin
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs confusion
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls confusion
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/mike/Bootstrap4/conFusion/npm-debug.log

El archivo npm-debug.log esta :

0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/nodejs', '/usr/bin/npm', 'run', 'build' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle [email protected]~prebuild: [email protected]
6 silly lifecycle [email protected]~prebuild: no script for prebuild, continuing
7 info lifecycle [email protected]~build: [email protected]
8 verbose lifecycle [email protected]~build: unsafe-perm in lifecycle true
9 verbose lifecycle [email protected]~build: PATH: /usr/share/npm/bin/node-gyp-bin:/home/mike/Bootstrap4/conFusion/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
10 verbose lifecycle [email protected]~build: CWD: /home/mike/Bootstrap4/conFusion
11 silly lifecycle [email protected]~build: Args: [ '-c',
11 silly lifecycle   'npm run clean && npm run imagemin && npm run copyfonts && npm run usemin' ]
12 silly lifecycle [email protected]~build: Returned: code: 1  signal: null
13 info lifecycle [email protected]~build: Failed to exec build script
14 verbose stack Error: [email protected] build: `npm run clean && npm run imagemin && npm run copyfonts && npm run usemin`
14 verbose stack Exit status 1
14 verbose stack     at EventEmitter.<anonymous> (/usr/share/npm/lib/utils/lifecycle.js:232:16)
14 verbose stack     at emitTwo (events.js:87:13)
14 verbose stack     at EventEmitter.emit (events.js:172:7)
14 verbose stack     at ChildProcess.<anonymous> (/usr/share/npm/lib/utils/spawn.js:24:14)
14 verbose stack     at emitTwo (events.js:87:13)
14 verbose stack     at ChildProcess.emit (events.js:172:7)
14 verbose stack     at maybeClose (internal/child_process.js:821:16)
14 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
15 verbose pkgid [email protected]
16 verbose cwd /home/mike/Bootstrap4/conFusion
17 error Linux 4.10.0-42-generic
18 error argv "/usr/bin/nodejs" "/usr/bin/npm" "run" "build"
19 error node v4.2.6
20 error npm  v3.5.2
21 error code ELIFECYCLE
22 error [email protected] build: `npm run clean && npm run imagemin && npm run copyfonts && npm run usemin`
22 error Exit status 1
23 error Failed at the [email protected] build script 'npm run clean && npm run imagemin && npm run copyfonts && npm run usemin'.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the confusion package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error     npm run clean && npm run imagemin && npm run copyfonts && npm run usemin
23 error You can get information on how to open an issue for this project with:
23 error     npm bugs confusion
23 error Or if that isn't available, you can get their info via:
23 error     npm owner ls confusion
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]

Despues de descargar la última versión de npm

Así que descargué la última versión de npm y ahora tengo :

mike@mike-thinks:~/Bootstrap4/conFusion$ npm run build

> [email protected] build /home/mike/Bootstrap4/conFusion
> npm run clean && npm run imagemin && npm run copyfonts && npm run usemin


> [email protected] clean /home/mike/Bootstrap4/conFusion
> rimraf dist


> [email protected] imagemin /home/mike/Bootstrap4/conFusion
> imagemin img/* -o dist/img

Error: Error in file: img/logo.png

spawn /usr/local/lib/node_modules/imagemin-cli/node_modules/optipng-bin/vendor/optipng ENOENT
    at _errnoException (util.js:1031:13)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:201:19)
    at onErrorNT (internal/child_process.js:389:16)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] imagemin: `imagemin img/* -o dist/img`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] imagemin 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/mike/.npm/_logs/2017-12-27T11_42_38_033Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: `npm run clean && npm run imagemin && npm run copyfonts && npm run usemin`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] 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/mike/.npm/_logs/2017-12-27T11_42_38_103Z-debug.log

Aqui estan el log para imagemin: imagemin img/* -o dist/img, 2017-12-27T11_42_38_033Z-debug.log` :

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'imagemin' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'preimagemin', 'imagemin', 'postimagemin' ]
5 info lifecycle [email protected]~preimagemin: [email protected]
6 info lifecycle [email protected]~imagemin: [email protected]
7 verbose lifecycle [email protected]~imagemin: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~imagemin: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/home/mike/Bootstrap4/conFusion/node_modules/.bin:/usr/local/lib/node_modules/npm/bin/node-gyp-bin:/home/mike/Bootstrap4/conFusion/node_modules/.bin:/home/mike/bin:/home/mike/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin:/usr/lib/jvm/java-version/bin:/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java/bin:/usr/local/hadoop/bin
9 verbose lifecycle [email protected]~imagemin: CWD: /home/mike/Bootstrap4/conFusion
10 silly lifecycle [email protected]~imagemin: Args: [ '-c', 'imagemin img/* -o dist/img' ]
11 silly lifecycle [email protected]~imagemin: Returned: code: 1  signal: null
12 info lifecycle [email protected]~imagemin: Failed to exec imagemin script
13 verbose stack Error: [email protected] imagemin: `imagemin img/* -o dist/img`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:280:16)
13 verbose stack     at EventEmitter.emit (events.js:159:13)
13 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:159:13)
13 verbose stack     at maybeClose (internal/child_process.js:943:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:220:5)
14 verbose pkgid [email protected]
15 verbose cwd /home/mike/Bootstrap4/conFusion
16 verbose Linux 4.10.0-42-generic
17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "imagemin"
18 verbose node v9.2.1
19 verbose npm  v5.5.1
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] imagemin: `imagemin img/* -o dist/img`
22 error Exit status 1
23 error Failed at the [email protected] imagemin script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

Y el log para [email protected] build script, 2017-12-27T11_42_38_103Z-debug.log

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'build' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle [email protected]~prebuild: [email protected]
6 info lifecycle [email protected]~build: [email protected]
7 verbose lifecycle [email protected]~build: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~build: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/home/mike/Bootstrap4/conFusion/node_modules/.bin:/home/mike/bin:/home/mike/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin:/usr/lib/jvm/java-version/bin:/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java/bin:/usr/local/hadoop/bin
9 verbose lifecycle [email protected]~build: CWD: /home/mike/Bootstrap4/conFusion
10 silly lifecycle [email protected]~build: Args: [ '-c',
10 silly lifecycle   'npm run clean && npm run imagemin && npm run copyfonts && npm run usemin' ]
11 silly lifecycle [email protected]~build: Returned: code: 1  signal: null
12 info lifecycle [email protected]~build: Failed to exec build script
13 verbose stack Error: [email protected] build: `npm run clean && npm run imagemin && npm run copyfonts && npm run usemin`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:280:16)
13 verbose stack     at EventEmitter.emit (events.js:159:13)
13 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:159:13)
13 verbose stack     at maybeClose (internal/child_process.js:943:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:220:5)
14 verbose pkgid [email protected]
15 verbose cwd /home/mike/Bootstrap4/conFusion
16 verbose Linux 4.10.0-42-generic
17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "build"
18 verbose node v9.2.1
19 verbose npm  v5.5.1
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] build: `npm run clean && npm run imagemin && npm run copyfonts && npm run usemin`
22 error Exit status 1
23 error Failed at the [email protected] build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

###Actualización :

Fui a ver si había un problema con el proceso hijo (este caso imagemin). El no termino con un código de estatus 0. Corré el comando imagemin img/* -o dist/img en el terminal para que puedo ver si esta enviando algún mensaje de error al terminal. Me contesta :

mike@mike-thinks:~/Bootstrap4/conFusion$ imagemin img/* -o dist/img
Error: Error in file: img/alberto.png

spawn /usr/local/lib/node_modules/imagemin-cli/node_modules/optipng-bin/vendor/optipng ENOENT
    at _errnoException (util.js:1031:13)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:201:19)
    at onErrorNT (internal/child_process.js:389:16)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)