chriswessels/meteor-tupperware

Docker build can't install 'fibers' because 'python' is missing

aedm opened this issue · 14 comments

aedm commented

My Dockerfile only contains FROM quay.io/chriswessels/meteor-tupperware and I have no tupperware.json. My OS is Windows. This is what I get:

Sending build context to Docker daemon 23.61 MB
Step 1 : FROM quay.io/chriswessels/meteor-tupperware
# Executing 2 build triggers...
Step 1 : COPY ./ /app
Step 1 : RUN sh /tupperware/scripts/on_build.sh
 ---> Running in f0cca5ec3575

  _
 | |_ _   _ _ __  _ __   ___ _ ____      ____ _ _ __ ___
 | __| | | | '_ \| '_ \ / _ \ '__\ \ /\ / / _` | '__/ _ \
 | |_| |_| | |_) | |_) |  __/ |   \ V  V / (_| | | |  __/
  \__|\__,_| .__/| .__/ \___|_|    \_/\_/ \__,_|_|  \___|
           |_|   |_|

[-]  github.com/chriswessels/meteor-tupperware (tupperbuild v1.0.0)

[-]  No tupperware.json found, using defaults.
[-]  Downloading Meteor 1.3 Installer...
[-]  Installing Meteor 1.3...
[-]  Building your app...
[-]  Installing npm dependencies for your app...
[!]  While attempting to install your application's npm dependencies, the command: npm install
[!]  Failed with the exit code 1. The signal was null.
[-]  The task produced the following stdout:

> fibers@1.0.8 install /output/bundle/programs/server/node_modules/fibers
> node build.js || nodejs build.js


[-]  The task produced the following stderr:
npm WARN package.json meteor-dev-bundle@0.0.0 No description
npm WARN package.json meteor-dev-bundle@0.0.0 No repository field.
npm WARN package.json meteor-dev-bundle@0.0.0 No README data
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack     at failNoPython (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:103:14)
gyp ERR! stack     at /usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:42:11
gyp ERR! stack     at F (/usr/local/lib/node_modules/npm/node_modules/which/which.js:43:25)
gyp ERR! stack     at E (/usr/local/lib/node_modules/npm/node_modules/which/which.js:46:29)
gyp ERR! stack     at /usr/local/lib/node_modules/npm/node_modules/which/which.js:57:16
gyp ERR! stack     at Object.oncomplete (evalmachine.<anonymous>:108:15)
gyp ERR! System Linux 4.1.13-boot2docker
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--release"
gyp ERR! cwd /output/bundle/programs/server/node_modules/fibers
gyp ERR! node -v v0.10.40
gyp ERR! node-gyp -v v1.0.1
gyp ERR! not ok
Build failed
sh: 1: nodejs: not found

npm ERR! fibers@1.0.8 install: `node build.js || nodejs build.js`
npm ERR! Exit status 127
npm ERR!
npm ERR! Failed at the fibers@1.0.8 install script.
npm ERR! This is most likely a problem with the fibers package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node build.js || nodejs build.js
npm ERR! You can get their info via:
npm ERR!     npm owner ls fibers
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 4.1.13-boot2docker
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "install"
npm ERR! cwd /output/bundle/programs/server
npm ERR! node -v v0.10.40
npm ERR! npm -v 1.4.28
npm ERR! code ELIFECYCLE
npm ERR! not ok code 0

[-]  Container build failed. meteor-tupperware is exiting...
SECURITY WARNING: You are building a Docker image from Windows against a non-Windows Docker host. All files and directories added to build context will have '-rwxr-xr-x' permissions. It is recommended to double check and reset permissions for sensitive files and directories.
The command '/bin/sh -c sh /tupperware/scripts/on_build.sh' returned a non-zero code: 1

Same here ... But with a hint to update to latest npm:

`Sending build context to Docker daemon 417.4 MB
Step 1 : FROM quay.io/chriswessels/meteor-tupperware

Executing 2 build triggers...

Step 1 : COPY ./ /app
Step 1 : RUN sh /tupperware/scripts/on_build.sh
---> Running in 1fa166b72ceb

_
| |_ _ _ _ __ _ __ ___ _ ____ ____ _ _ __ ___
| | | | | '_ | '_ \ / _ \ '\ \ /\ / / ` | '__/ _
| |
| || | |) | |) | **/ | \ V V / (| | | | /
**|
,| ./| ./ **|| _// **,|| _|
|
| |
|

[-] github.com/chriswessels/meteor-tupperware (tupperbuild v1.0.0)

[-] No tupperware.json found, using defaults.
[-] Downloading Meteor 1.3.1 Installer...
[-] Installing Meteor 1.3.1...
[-] Building your app...
[-] Installing npm dependencies for your app...
[!] While attempting to install your application's npm dependencies, the command: npm install
[!] Failed with the exit code 1. The signal was null.
[-] The task produced the following stdout:

fibers@1.0.8 install /output/bundle/programs/server/node_modules/fibers
node build.js || nodejs build.js

[-] The task produced the following stderr:
npm WARN deprecated This version of npm lacks support for important features,
npm WARN deprecated such as scoped packages, offered by the primary npm
npm WARN deprecated registry. Consider upgrading to at least npm@2, if not the
npm WARN deprecated latest stable version. To upgrade to npm@2, run:
npm WARN deprecated
npm WARN deprecated npm -g install npm@latest-2
npm WARN deprecated
npm WARN deprecated To upgrade to the latest stable version, run:
npm WARN deprecated
npm WARN deprecated npm -g install npm@latest
npm WARN deprecated
npm WARN deprecated (Depending on how Node.js was installed on your system, you
npm WARN deprecated may need to prefix the preceding commands with sudo, or if
npm WARN deprecated on Windows, run them from an Administrator prompt.)
npm WARN deprecated
npm WARN deprecated If you're running the version of npm bundled with
npm WARN deprecated Node.js 0.10 LTS, be aware that the next version of 0.10 LTS
npm WARN deprecated will be bundled with a version of npm@2, which has some small
npm WARN deprecated backwards-incompatible changes made to npm run-script and
npm WARN deprecated semver behavior.
npm WARN package.json meteor-dev-bundle@0.0.0 No description
npm WARN package.json meteor-dev-bundle@0.0.0 No repository field.
npm WARN package.json meteor-dev-bundle@0.0.0 No README data
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack at failNoPython (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:103:14)
gyp ERR! stack at /usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:42:11
gyp ERR! stack at F (/usr/local/lib/node_modules/npm/node_modules/which/which.js:43:25)
gyp ERR! stack at E (/usr/local/lib/node_modules/npm/node_modules/which/which.js:46:29)
gyp ERR! stack at /usr/local/lib/node_modules/npm/node_modules/which/which.js:57:16
gyp ERR! stack at Object.oncomplete (evalmachine.:108:15)
gyp ERR! System Linux 4.2.0-23-generic
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--release"
gyp ERR! cwd /output/bundle/programs/server/node_modules/fibers
gyp ERR! node -v v0.10.43
gyp ERR! node-gyp -v v1.0.1
gyp ERR! not ok
Build failed
sh: 1: nodejs: not found

npm ERR! fibers@1.0.8 install: node build.js || nodejs build.js
npm ERR! Exit status 127
npm ERR!
npm ERR! Failed at the fibers@1.0.8 install script.
npm ERR! This is most likely a problem with the fibers package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node build.js || nodejs build.js
npm ERR! You can get their info via:
npm ERR! npm owner ls fibers
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 4.2.0-23-generic
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "install"
npm ERR! cwd /output/bundle/programs/server
npm ERR! node -v v0.10.43
npm ERR! npm -v 1.4.29
npm ERR! code ELIFECYCLE
npm ERR! not ok code 0

[-] Container build failed. meteor-tupperware is exiting...
The command '/bin/sh -c sh /tupperware/scripts/on_build.sh' returned a non-zero code: 1
`

@chriswessels since you are installing meteor, you can use the new meteor npm command instead of installing an externally-fetched npm.

Same problem on Ubuntu.

Python has become a requirement of building the app with Meteor 1.3. You can do this by adding a preBuildCommand to your tupperware.json file. I'm working on a new version of Tupperware that will do this automatically.

maxfi commented

To expand on @chriswessels comment the following tupperware.json fixes the issue:

{
  "dependencies": {
    "phantomJs": false,
    "imageMagick": false
  },
  "preBuildCommands": ["sudo apt-get update && sudo apt-get install -y build-essential python"],
  "postBuildCommands": [],
  "buildOptions": {
    "mobileServerUrl": false,
    "additionalFlags": false
  }
}

the preBuildCommands property making the difference.

Is this OS specific? This doesn't appear to solve the problem yet for me on OS X. I'm poking around at it to see if I can find a workaround to share.

ntkog commented

Try to add --force=yes to preBuildCommands line

"preBuildCommands": ["sudo apt-get update && sudo apt-get install -y  --force=yes build-essential python"]
area commented

The flag for apt-get is --force-yes.

maxfi commented

I think this is fixed in the latest version (1.3.0). I no longer require this tupperware.json to get a successful build.

@maxfi Thanks for the report. Can anyone else confirm?

I'm still seeing this issue on both the latest and 1.3.0 Docker images, when installing bcrypt:

...
=> Errors while initializing project:

While downloading npm-bcrypt@0.8.7...:
...
gyp ERR! node -v v4.4.7
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok

npm ERR! Linux 4.4.19-moby
npm ERR! argv
"/root/.meteor/packages/meteor-tool/.1.4.0-1.13j49n2++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/bin/node"
"/root/.meteor/packages/meteor-tool/.1.4.0-1.13j49n2++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/bin/npm"
"rebuild" "--no-bin-links" "--update-binary"
npm ERR! node v4.4.7
npm ERR! npm  v3.10.5
npm ERR! code ELIFECYCLE
npm ERR! bcrypt@0.8.7 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the bcrypt@0.8.7 install script 'node-gyp rebuild'.
...
gyp ERR! stack Error: Can't find Python executable "python", you can set the
PYTHON env variable.
gyp ERR! stack     at failNoPython
(/root/.meteor/packages/meteor-tool/.1.4.0-1.13j49n2++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:449:14)
...

The tupperware.json workaround fixes it.

maxfi commented

@jonatanblue I should have specified that I'm using Meteor v1.4.1.1. If you upgrade to that version do you still have the issue?

Thanks @maxfi. I was running Meteor v1.4.0.1. After upgrading to v1.4.1.1 it's working without the tupperware.json file.

Okay, thanks for debugging @maxfi and reporting @jonatanblue. If anyone else has this issue, please ensure you're using Meteor v1.4.1.1+ or use a tupperware.json with preBuildCommands set as follows:

{
  "dependencies": {
    "phantomJs": false,
    "imageMagick": false
  },
  "preBuildCommands": ["sudo apt-get update && sudo apt-get install -y build-essential python"],
  "postBuildCommands": [],
  "buildOptions": {
    "mobileServerUrl": false,
    "additionalFlags": false
  }
}