Trouble installing NPM when using Phusion Passenger to deploy my app

Does anyone here have experience deploying their app with Phusion Passenger? I get this error when trying to install npm via npm install --production:

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
npm WARN package.json meteor-dev-bundle@0.0.0 No license field.
npm WARN cannot run in wd meteor-dev-bundle@0.0.0 node npm-rebuild.js (wd=/var/www/myApp/bundle/programs/server)

This is the result when I finish the tutorial:

There is a problem in my deployment and the only problem I come across is installing npm, so I’m assuming that it’s the problem.

I’m having a somewhat similar problem when deploying to heroku since tuesday. It’s been hell trying to debug where is the error.
Only thing I could find is: it seems like there’s a memory overflow somewhere, causing the build to crash. I still did not manage to reproduce the error locally, but it also happens if you deploy to meteor galaxy, dokku, flynn, or something similar.

Right now I’m using a temporal server which I deploy using meteor-up.

If I find something else I’ll add it here.

Quick update: after some hours of exploring the dependencies in my project, I found xmlbuilder was causing some weird issues with meteor’s build system. After removing all packages using it as a dependency (npm ls and search for xmlbuilder), everything seems to work.
I’m still looking for the real problem, but being able to make the app run is good enough for now.

Yeah, I’ll have to keep looking.

I tried this whole thing over for like the 10th time already and now I’m getting this completely different npm error:

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
npm WARN package.json meteor-dev-bundle@0.0.0 No license field.
-
> fibers@1.0.13 install /var/www/ayy/bundle/programs/server/node_modules/f                                                                                                                         ibers
> node build.js || nodejs build.js

`linux-x64-v8-4.5` exists; testing
Binary is fine; exiting

> meteor-dev-bundle@0.0.0 install /var/www/ayy/bundle/programs/server
> node npm-rebuild.js


> bcrypt@0.8.7 install /var/www/ayy/bundle/programs/server/npm/node_module                                                                                                                         s/meteor/npm-bcrypt/node_modules/bcrypt
> node-gyp rebuild

gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYT                                                                                                                         HON env variable.
gyp ERR! stack     at failNoPython (/usr/lib/node_modules/npm/node_modules/node-                                                                                                                         gyp/lib/configure.js:449:14)
gyp ERR! stack     at /usr/lib/node_modules/npm/node_modules/node-gyp/lib/config                                                                                                                         ure.js:353:11
gyp ERR! stack     at F (/usr/lib/node_modules/npm/node_modules/which/which.js:6                                                                                                                         9:16)
gyp ERR! stack     at E (/usr/lib/node_modules/npm/node_modules/which/which.js:8                                                                                                                         1:29)
gyp ERR! stack     at /usr/lib/node_modules/npm/node_modules/which/which.js:90:1                                                                                                                         6
gyp ERR! stack     at /usr/lib/node_modules/npm/node_modules/which/node_modules/                                                                                                                         isexe/index.js:44:5
gyp ERR! stack     at /usr/lib/node_modules/npm/node_modules/which/node_modules/                                                                                                                         isexe/access.js:8:5
gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:82:15)
gyp ERR! System Linux 4.4.0-59-generic
gyp ERR! command "/usr/bin/nodejs" "/usr/lib/node_modules/npm/node_modules/node-                                                                                                                         gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /var/www/ayy/bundle/programs/server/npm/node_modules/meteor/n                                                                                                                         pm-bcrypt/node_modules/bcrypt
gyp ERR! node -v v4.7.2
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok

npm ERR! Linux 4.4.0-59-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "rebuild" "--no-bin-links" "--upd                                                                                                                         ate-binary"
npm ERR! node v4.7.2
npm ERR! npm  v2.15.11
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'.
npm ERR! This is most likely a problem with the bcrypt package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs bcrypt
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR!     npm owner ls bcrypt
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /var/www/ayy/bundle/programs/server/npm/node_modules/meteor/n                                                                                                                         pm-bcrypt/npm-debug.log

npm ERR! Linux 4.4.0-59-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "--production"
npm ERR! node v4.7.2
npm ERR! npm  v2.15.11
npm ERR! code ELIFECYCLE
npm ERR! meteor-dev-bundle@0.0.0 install: `node npm-rebuild.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the meteor-dev-bundle@0.0.0 install script 'node npm-rebuild.                                                                                                                         js'.
npm ERR! This is most likely a problem with the meteor-dev-bundle package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node npm-rebuild.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs meteor-dev-bundle
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR!     npm owner ls meteor-dev-bundle
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /var/www/ayy/bundle/programs/server/npm-debug.log

It’s like if I fix an old issue, 2 new ones pop up somewhere.

Via the Passenger logs, I found what the problem is:

TypeError: Cannot read property 'stripe' of undefined
App 9635 stderr:     at meteorInstall.server.methods.js (server/methods.js:9:32)

Looks like the stripe NPM package isn’t properly installed on my server, which leads to a bigger problem with 0 installed npm packages present in my app. I just can’t install my app’s npm dependencies. No idea why.

Did you make sure the node version on your server matches the required node version of your app’s meteor verison?

Also, did you make sure you’ve installed necessary build tools, eg sudo apt install build-essential ?

The node version doesn’t match. I think server it’s 4.4.7 and my app is 4.4.2. I’m not sure if I did apt install build-essential. I simply followed this tutorial: https://www.phusionpassenger.com/library/walkthroughs/deploy/meteor/

In that case, please make sure your node version does match and also
install build-essential.

After that, you should be able to cd into the programs/server directory of
your app bundle and do an npm install --production

Alright, installed npm and I think it is good now. However, my app won’t start with the screen in the OP.

I opened the Passenger error log and get this:

App 13045 stderr: assert.js:92
App 13045 stderr:   throw new assert.AssertionError({
App 13045 stderr:
App 13045 stderr:
App 13045 stderr:
App 13045 stderr:
App 13045 stderr:
App 13045 stderr:
App 13045 stderr:
App 13045 stderr:
App 13045 stderr: ^
App 13045 stderr:
App 13045 stderr: AssertionError: "undefined" === "function"
App 13045 stderr:     at wrapPathFunction (/var/www/myApp/bundle/programs/server/mini-files.js:77:10)
App 13045 stderr:     at Object.<anonymous> (/var/www/myApp/bundle/programs/server/mini-files.js:108:24)
App 13045 stderr:     at Module._compile (module.js:456:26)
App 13045 stderr:     at Object.Module._extensions..js (module.js:474:10)
App 13045 stderr:     at Module.load (module.js:356:32)
App 13045 stderr:     at Function.Module._load (module.js:312:12)
App 13045 stderr:     at Module.require (module.js:364:17)
App 13045 stderr:     at Module.require (/usr/share/passenger/helper-scripts/node-loader.js:81:25)
App 13045 stderr:     at require (module.js:380:17)
App 13045 stderr:     at Object.<anonymous> (/var/www/myApp/bundle/programs/server/boot.js:9:13)
[ 2017-01-22 22:40:28.0389 13016/7fa701e3e700 age/Cor/App/Implementation.cpp:304 ]: Could not spawn process for application /var/www/myApp/bundle: An error occurred while starting the web applicat$
  Error ID: 3d72c638
  Error details saved to: /tmp/passenger-error-uVIjgs.html
  Message from application: An error occurred while starting the web application. It exited before signalling successful startup back to Phusion Passenger. Please read <a href="https://github.com/phus$
<h2>Raw process output:</h2>
<pre>

assert.js:92
  throw new assert.AssertionError({
        ^
AssertionError: &quot;undefined&quot; === &quot;function&quot;
    at wrapPathFunction (/var/www/myApp/bundle/programs/server/mini-files.js:77:10)
    at Object.&lt;anonymous&gt; (/var/www/myApp/bundle/programs/server/mini-files.js:108:24)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at Module.require (/usr/share/passenger/helper-scripts/node-loader.js:81:25)
    at require (module.js:380:17)
    at Object.&lt;anonymous&gt; (/var/www/myApp/bundle/programs/server/boot.js:9:13)
</pre>

[ 2017-01-22 22:40:28.0439 13016/7fa703cd7700 age/Cor/Con/CheckoutSession.cpp:285 ]: [Client 1-1] Cannot checkout session because a spawning error occurred. The identifier of the error is 3d72c638. Pl$

Apparently, this means that the node version I’m using isn’t the right one, which is wrong because it’s v4.4.2 on development machine and on host machine.

what do you get when you type

meteor node --version

within your app project directory on your local development machine

and what do you get when you type

node --version

anywhere on your deployment server?

(also, notice the differences between the commands, first one is prefixed
with meteor)

I get 4.4.7 on development and 4.7.2 on deployment server. (I always did node -v on development to see the version of Node)

I don’t get it. I change the node version via nvm install v4.4.7 and it changes node version. When I log out and back in, the node version reverts back to 4.7.2?

Here is what happens:

  1. I install correct Node version (version 4.4.7).

  2. When I run npm install --production, I get this error:

sh: 1: node: not found
npm ERR! weird error 127
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian

From my research, that means my app uses some legacy node. To help solve this problem, I run sudo apt-get install nodejs-legacy and the problem is solved. However, the node version reverts all the way to v0.10.25, which causes the errors above. It’s a negative feedback loop.

I just destroyed and created a new DO instance, had the right version on both systems:

and


…and still get that error above. Seems like node version isn’t the problem, even though the error log indicates it is.

nvm sets it for your user whereas passenger uses a global default! you can
tell passenger what node to use via the nginx conf section on your app, or
set node default to the required one on nvm.

what’s your meteor version?

please try this at the root folder of your meteor project (development environment)

  • meteor reset
  • rm -fr node_modules
  • meteor npm install
  • meteor run

see if the project runs successfully and if it does, build your project with meteor build

and then on your server, make sure you install node from the correct node ppa’s as described here:

https://www.phusionpassenger.com/library/walkthroughs/deploy/meteor/digital_ocean/nginx/oss/install_language_runtime.html