The docker build command fails and doesn't produce anything.
Checkout the project @ tag v7.4.1 and issue the docker build -t local/nativefier . command.
Tried also with v7.4.0 but still nothing.
17.09.0-ce, build afdb6d4nativefier --version): v7.4.1 (checked out the corresponding tag)node --version): v7.10.1Linux 4.10.0-35-generic[...]
> [email protected] build /nativefier
> gulp build
[13:51:25] Requiring external module babel-register
[13:51:26] Using gulpfile /nativefier/gulpfile.babel.js
[13:51:26] Starting 'build'...
[13:51:26] Starting 'clean'...
[13:51:26] Finished 'clean' after 8.06 ms
[13:51:26] Starting 'build-cli'...
[13:51:26] Starting 'build-static-js'...
[13:51:26] Starting 'build-static-not-js'...
[13:51:26] Starting 'build-tests'...
[13:51:26] Finished 'build-static-not-js' after 383 ms
[13:51:26] Finished 'build-static-js' after 442 ms
[13:51:26] Starting 'build-static'...
[13:51:26] Finished 'build-static' after 67 μs
[13:51:26] Starting 'build-app'...
[13:51:27] Finished 'build-tests' after 1.05 s
internal/streams/legacy.js:59
throw er; // Unhandled stream error in pipe.
^
Error: ./app/~/mime-db/db.json
Module parse failed: /nativefier/app/node_modules/mime-db/db.json Unexpected token (2:40)
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected token (2:40)
at Parser.pp$4.raise (/nativefier/node_modules/webpack/node_modules/acorn/dist/acorn.js:2221:15)
at Parser.pp.unexpected (/nativefier/node_modules/webpack/node_modules/acorn/dist/acorn.js:603:10)
at Parser.pp.semicolon (/nativefier/node_modules/webpack/node_modules/acorn/dist/acorn.js:581:61)
at Parser.pp$1.parseExpressionStatement (/nativefier/node_modules/webpack/node_modules/acorn/dist/acorn.js:966:10)
at Parser.pp$1.parseStatement (/nativefier/node_modules/webpack/node_modules/acorn/dist/acorn.js:730:24)
at Parser.pp$1.parseBlock (/nativefier/node_modules/webpack/node_modules/acorn/dist/acorn.js:981:25)
at Parser.pp$1.parseStatement (/nativefier/node_modules/webpack/node_modules/acorn/dist/acorn.js:709:33)
at Parser.pp$1.parseTopLevel (/nativefier/node_modules/webpack/node_modules/acorn/dist/acorn.js:638:25)
at Parser.parse (/nativefier/node_modules/webpack/node_modules/acorn/dist/acorn.js:516:17)
at Object.parse (/nativefier/node_modules/webpack/node_modules/acorn/dist/acorn.js:3098:39)
@ ./app/~/mime-db/index.js 11:17-37
npm info lifecycle [email protected]~build: Failed to exec build script
npm ERR! Linux 4.10.0-35-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "build"
npm ERR! node v7.10.1
npm ERR! npm v4.2.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: `gulp build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build script 'gulp build'.
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 nativefier package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! gulp build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs nativefier
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls nativefier
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /root/.npm/_logs/2017-10-09T13_51_27_980Z-debug.log
The command '/bin/sh -c cd /nativefier/app && npm install && cd /nativefier && npm install && npm run build && npm install -g && rm -rf /nativefier' returned a non-zero code: 1
@filippobuletto thank you for the report. Smells like npm barfing like another user noticed at https://github.com/jiahaog/nativefier/issues/451#issuecomment-331230913 . Could you try one of those:
RUN npm install -g --upgrade npm to the dockerfileFROM node:8-alpine, which uses and unbarfed npm 5.xThank you too! I've already tried 4-alpine, 6-alpine and 8-alpine without any success...
Here the resulting log with the latest (8-alpine):
> [email protected] build /nativefier
> gulp build
[14:57:44] Requiring external module babel-register
[14:57:45] Using gulpfile /nativefier/gulpfile.babel.js
[14:57:45] Starting 'build'...
[14:57:45] Starting 'clean'...
[14:57:45] Finished 'clean' after 5.7 ms
[14:57:45] Starting 'build-cli'...
[14:57:45] Starting 'build-static-js'...
[14:57:45] Starting 'build-static-not-js'...
[14:57:45] Starting 'build-tests'...
[14:57:45] Finished 'build-static-not-js' after 203 ms
[14:57:45] Finished 'build-static-js' after 251 ms
[14:57:45] Starting 'build-static'...
[14:57:45] Finished 'build-static' after 44 μs
[14:57:45] Starting 'build-app'...
[14:57:46] Finished 'build-tests' after 664 ms
internal/streams/legacy.js:59
throw er; // Unhandled stream error in pipe.
^
Error: ./app/~/mime-db/db.json
Module parse failed: /nativefier/app/node_modules/mime-db/db.json Unexpected token (2:40)
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected token (2:40)
at Parser.pp$4.raise (/nativefier/node_modules/webpack/node_modules/acorn/dist/acorn.js:2221:15)
at Parser.pp.unexpected (/nativefier/node_modules/webpack/node_modules/acorn/dist/acorn.js:603:10)
at Parser.pp.semicolon (/nativefier/node_modules/webpack/node_modules/acorn/dist/acorn.js:581:61)
at Parser.pp$1.parseExpressionStatement (/nativefier/node_modules/webpack/node_modules/acorn/dist/acorn.js:966:10)
at Parser.pp$1.parseStatement (/nativefier/node_modules/webpack/node_modules/acorn/dist/acorn.js:730:24)
at Parser.pp$1.parseBlock (/nativefier/node_modules/webpack/node_modules/acorn/dist/acorn.js:981:25)
at Parser.pp$1.parseStatement (/nativefier/node_modules/webpack/node_modules/acorn/dist/acorn.js:709:33)
at Parser.pp$1.parseTopLevel (/nativefier/node_modules/webpack/node_modules/acorn/dist/acorn.js:638:25)
at Parser.parse (/nativefier/node_modules/webpack/node_modules/acorn/dist/acorn.js:516:17)
at Object.parse (/nativefier/node_modules/webpack/node_modules/acorn/dist/acorn.js:3098:39)
@ ./app/~/mime-db/index.js 11:17-37
npm info lifecycle [email protected]~build: Failed to exec build script
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: `gulp build`
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! /root/.npm/_logs/2017-10-09T14_57_46_702Z-debug.log
The command '/bin/sh -c cd /nativefier/app && npm install && cd /nativefier && npm install && npm run build && npm install -g && rm -rf /nativefier' returned a non-zero code: 1
Adding the RUN.. command you provided like:
diff --git a/Dockerfile b/Dockerfile
index c65e04a..4d905e4 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -13,6 +13,7 @@ RUN apk add --no-cache \
COPY . /nativefier
### Build app package for nativefier installation
+RUN npm install -g --upgrade npm
RUN cd /nativefier/app && npm install \
# Build and install nativefier binary
&& cd /nativefier && npm install && npm run build && npm install -g \
The result is:
⇒ docker build -t local/nativefier .
Sending build context to Docker daemon 7.089MB
Step 1/10 : FROM node:7-alpine
---> 4b72b56791f9
Step 2/10 : LABEL description "Alpine image to build nativfier apps"
---> Using cache
---> 92b56e8701fa
Step 3/10 : RUN apk add --no-cache wine freetype imagemagick && ln -s /usr/bin/wine64 /usr/bin/wine
---> Using cache
---> 9bc093663741
Step 4/10 : COPY . /nativefier
---> Using cache
---> d1ae038f6292
Step 5/10 : RUN npm install -g --upgrade npm
---> Using cache
---> 354ae14b1715
Step 6/10 : RUN cd /nativefier/app && npm install && cd /nativefier && npm install && npm run build && npm install -g && rm -rf /nativefier
---> Running in 7be89c7ef7d6
module.js:472
throw err;
^
Error: Cannot find module 'process-nextick-args'
at Function.Module._resolveFilename (module.js:470:15)
at Function.Module._load (module.js:418:25)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/readable-stream/lib/_stream_readable.js:26:23)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
The command '/bin/sh -c cd /nativefier/app && npm install && cd /nativefier && npm install && npm run build && npm install -g && rm -rf /nativefier' returned a non-zero code: 1
Same using both (8-alpine AND add the RUN command)
diff --git a/Dockerfile b/Dockerfile
index c65e04a..5a288d1 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,4 +1,4 @@
-FROM node:7-alpine
+FROM node:8-alpine
LABEL description="Alpine image to build nativfier apps"
### Install wine depedency
@@ -13,6 +13,7 @@ RUN apk add --no-cache \
COPY . /nativefier
### Build app package for nativefier installation
+RUN npm install -g --upgrade npm
RUN cd /nativefier/app && npm install \
# Build and install nativefier binary
&& cd /nativefier && npm install && npm run build && npm install -g \
⇒ docker build -t local/nativefier .
Sending build context to Docker daemon 7.089MB
Step 1/10 : FROM node:8-alpine
---> b7e15c83cdaf
Step 2/10 : LABEL description "Alpine image to build nativfier apps"
---> Using cache
---> c5510cd30161
Step 3/10 : RUN apk add --no-cache wine freetype imagemagick && ln -s /usr/bin/wine64 /usr/bin/wine
---> Using cache
---> 4df14c1c04d6
Step 4/10 : COPY . /nativefier
---> Using cache
---> 86c03f37864b
Step 5/10 : RUN npm install -g --upgrade npm
---> Using cache
---> 1f8958eaedb0
Step 6/10 : RUN cd /nativefier/app && npm install && cd /nativefier && npm install && npm run build && npm install -g && rm -rf /nativefier
---> Running in b19520279d42
module.js:529
throw err;
^
Error: Cannot find module 'npmlog'
at Function.Module._resolveFilename (module.js:527:15)
at Function.Module._load (module.js:476:23)
at Module.require (module.js:568:17)
at require (internal/module.js:11:18)
at /usr/local/lib/node_modules/npm/bin/npm-cli.js:22:13
at Object.<anonymous> (/usr/local/lib/node_modules/npm/bin/npm-cli.js:92:3)
at Module._compile (module.js:624:30)
at Object.Module._extensions..js (module.js:635:10)
at Module.load (module.js:545:32)
at tryModuleLoad (module.js:508:12)
The command '/bin/sh -c cd /nativefier/app && npm install && cd /nativefier && npm install && npm run build && npm install -g && rm -rf /nativefier' returned a non-zero code: 1
Thanks for the support!
Worth noting that after release741 the builds in Docker Hub also started failing (about 2 months ago).
Also tried locally and got the same errors:
➜ ~ nodejs -v
v8.6.0
➜ ~ npm -v
5.4.2
➜ ~ cat /etc/lsb-release
DISTRIB_ID=LinuxMint
DISTRIB_RELEASE=18.2
DISTRIB_CODENAME=sonya
DISTRIB_DESCRIPTION="Linux Mint 18.2 Sonya"
I've also had issues building from source on Fedora 25 - and I'm getting the same error as docker builds above:
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build:gulp build
npm ERR! Exit status 1
gulp build fails? I've followed instructions on the Development page
I was having the json-loader issue.
I installed json-loader:
npm install --save-dev json-loader
Then added the json-loader under the babel-loader in the webpack.config.js:
loaders: [
{ test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader' },
{ test: /\.json$/, loader: 'json-loader' },
],
Most helpful comment
I was having the json-loader issue.
I installed json-loader:
Then added the json-loader under the babel-loader in the webpack.config.js: