Does someone know how to deploy meteor 1.4+ on IBM Bluemix?
Nothing seems to work.
meteor v 1.4.4.1
node.js v4.8.1
npm 4.2.0
mongodb 3.4.0
I tried demeteorizer github.com/XervoIO/demeteorizer but it doesn't figure out which version of nodejs it needs to set up.
I tried meteor buildpack github.com/ind1go/bluemix-buildpack-meteor, but it's 4+ years old, no way it'll work with meteor 1.4+.
I tried to run the application as a node.js one with the standard buildpack, I tried another from scalingo (github.com/Scalingo/nodejs-buildpack) which should support meteor better. This method is the one having the farest results even though I cannot succeed deploying. Here is the methode description:
npm install --production
meteor reset
meteor build /build --architecture os.linux.x86_64
cd /build && tar xvzf devance.tar.gz && chmod -R +w+x *
cd /build/bundle/programs/server/ && npm install
cd /build/bundle and create package.json with content:
{
"name": "myname",
"version": "1.0.0",
"dependencies": {
"meteor-promise": "0.8.0",
"fibers": "1.0.15",
"promise": "7.1.1",
"underscore": "1.5.2",
"source-map-support": "https://github.com/meteor/node-source-map-support/tarball/1912478769d76e5df4c365e147f25896aee6375e",
"semver": "4.1.0",
"node-gyp": "3.6.0",
"node-pre-gyp": "0.6.34"
},
"scripts": {
"start": "node main.js"
},
"engines": {
"node": "4.8.1",
"npm": "4.2.0"
},
"private": true
}
I test locally "node main.js", it works
cf push my-app -b https://github.com/Scalingo/nodejs-buildpack.git and it fails with the following error message from Bluemix CF.
ERR /home/vcap/app/programs/server/boot.js:356
ERR }).run();
ERR ^
ERR Error: Can't find npm module 'meteor-deque'. Did you forget to call 'Npm.depends' in package.js within the 'meteor' package?
ERR at Object.require (/home/vcap/app/programs/server/boot.js:200:17)
ERR at packages/meteor.js:677:32
ERR at packages/meteor.js:846:4
ERR at packages/meteor.js:1380:3
ERR at /home/vcap/app/programs/server/boot.js:303:34
ERR at Array.forEach (native)
ERR at Function._.each._.forEach (/home/vcap/app/node_modules/underscore/underscore.js:79:11)
ERR at /home/vcap/app/programs/server/boot.js:128:5
ERR at /home/vcap/app/programs/server/boot.js:352:5
ERR at Function.run (/home/vcap/app/programs/server/profile.js:510:12)
OUT Exit status 1
It clearly doesn't find the demetorized meteor packages. Any solutions would help.
Thanks
Scalingo's CTO and author of the buildpack here. A little disclaimer first. The buildpack has been designed to work on the Scalingo hosting platform first, but should work anywhere in theory. (In theory because it has not been tested properly elsewhere)
According to your error, the issue is related to a missing dependency in your package.json, you should run meteor npm install --save meteor-deque and commit the new version of the file. Then it should work as expected.
Regards,
Related
I've had a discord bot for a few weeks and everything has been working perfectly. Today I added a command on my git repository and suddenly heroku showed me this error:
Error: Cannot find module 'discord.js'
I didn't change anything in the main bot code nor in the package.json file. I removed the new command I added and pushed the new changes again, and still got the same error.
I tried to reinstall discord.js with npm install discord.js --save and updated the package.json with the new version. Still nothing.
The bot works if I run it locally, and it also works if I roll back to the last working build on Heroku.
My bot.js code to load the library:
const Discord = require("discord.js");
My package.json file:
{
"name": "redacted",
"description": "redacted",
"version": "1.0.0",
"main": "bot.js",
"scripts": {
"start": "node bot.js"
},
"dependencies": {
"discord.js": "^11.5.1",
"request": "2.81.0"
}
}
I don't know what to do because the code is exactly the same as the previous versions. I don't understand why I'm getting this error.
I believe the error may lie in your package.json file, you are a missing a few key things:
You must include the versions to use for both node and npm (I'd recommend using the latest):
"engines": {
"node": "12.14.1",
"npm": "6.13.4"
},
Next you need to also define your git repository like so:
"repository": {
"type": "git",
"url": "git+link"
},
As well make sure in your Procfile you have:
worker: npm start
In your requirements.txt make sure to have:
npm install discord.js
You can read more on hosting your discord.js bot on Heroku here.
Early days in the development of my first npm script, and struggling somewhat. I'm on Ubuntu LTS with the latest nvm, node, npm and pnpm releases.
Node + npm have been installed using nvm, pnpm installed using npm, and several modules installed locally (i.e. without the -g flag) using pnpm. No sudo was necessary. The resulting package.json:
{
"name": "javascript-development-environment",
"version": "1.0.0",
"description": "JavaScript development environment cobbled together using various online sources",
"scripts": {
"prestart": "./node_modules/.bin/babel buildScripts/startMessage.js",
"start": "./node_modules/.bin/babel buildScripts/srcServer.js"
},
"author": "Laird o' the Windy Waas",
"license": "MIT",
"dependencies": {
"#babel/polyfill": "^7.0.0"
},
"devDependencies": {
"#babel/cli": "^7.1.5",
"#babel/core": "^7.1.6",
"#babel/preset-env": "^7.1.6",
"chalk": "^2.4.1",
"express": "^4.16.4",
"open": "^0.0.5",
"path": "^0.12.7"
}
}
With only Firefox 60.0.1 installed, on doing a 'pnpm start' using node, a browser window is opened "Hello World!" displayed, and terminal control has to be regained using a CTRL-C. -> All ok.
If I substitute in babel using the path as shown above (which results from the same issues described in this post), the buildScripts code is echoed to the terminal, but no browser window opens, and terminal control is released immediately on completion. The npm debugger provides no useful feedback. -> Something not working..
As the "Hello World!" code is traversed correctly using node (and remains unchanged for the babel traversal), it is not the source of the problem.
Here my babel config files:
.babelrc
{
"presets": [
"#babel/preset-env"
]
}
babel.config.js
const presets = [
[
"#babel/env",
{
targets: {
edge: "17",
firefox: "61",
chrome: "67",
safari: "11.1",
opera: "56"
},
useBuiltIns: "usage"
},
],
];
module.exports = { presets };
The problem looks to be that babel is not passing the transpiled code on to nodejs / express. Bound to be something simple, but I'm just going round in circles..
One thing I found myself asking is whether there might be a conflict between the various env presets across .babelrc, babel.config.js and package.json. Successive parking of the .babelrc and babel.config.js files, however, brought no change/advance.
I have also noticed that both (nvms) node and (ubuntus) nodejs are currently installed:
$ which node
/home/<myusername>/.nvm/versions/node/v10.13.0/bin/node
$ which nodejs
/usr/bin/nodejs
However, as everything to do with node and npm was installed using nvm, this shouldn't be a problem.
I could, I suppose, try installing babel globally, but with this widely frowned apon. I'd prefer a solution reflecting 'best practice'.
Thanks for any suggestions.
In earlier years, tutor material suggested babel-node would start npm / node (and hence express) on the user's behalf.
babel-node now no longer seems to be recognised. Attempts at using the babel-node command failed, and simply using node in it's place resulted in the transpiler output being dumped to the terminal.
babel, (in our case) pnpm, and node now have to be explicitly called, the latter referencing the transpiled code. node appears to handle interfacing with express.
After some experiment, therefore, the following changes (in package.json) appear to work fine:
"scripts": {
"prestart": "./node_modules/.bin/babel buildScripts/startMessage.js -d dist",
"build": "./node_modules/.bin/babel buildScripts/srcServer.js -d dist",
"start": "pnpm run build && node dist/startMessage.js && node dist/srcServer.js"
},
These result both in a tidy console output and result in "Hallo World!" being displayed in a freshly opened browser window.
Just hope this is of use to someone else.. ;-)
Interesting problem, Using harp to build a simple app, then deploying it to Heroku, which is proving to be an issue. The last deploy worked flawlessly using the Harp buildpack, But now it's breaking on deploy.
Nothing has changed that should be causing this, no updates to node modules, or node version. the logs and Papertrail are complaining:
Error: `libsass` bindings not found. Try reinstalling `node-sass`?
After this, I branched off and tried to check on lib-sass in
/app/node_modules/harp/node_modules/terraform/node_modules/node-sass/lib/index.js:22
As per the logs, tried reinstalling it, but no avail. Anyone ever run into this? could it be a problem with the buildpack?
seems to be an issue with Node 0.12.
https://github.com/zeke/harp-buildpack/issues/12
I was able to get my app running by just not using the buildpack, adding
"dependencies": {
"harp": "~0.12.1"
},
"scripts": {
"start": "node server.js"
},
"engines": {
"node": "0.10.x"
},
to package.json and adding a server.js with
require('harp').server(__dirname, { port: process.env.PORT || 9000 })
Right now, I am trying to set up Node.js website connect to Azure SQL(Not MySQL).
I have created a simple program to get data from Azure mssql database.
On local it works fine.(It retrieves info from Azure MSSQL)
However, when I try to deploy, I get "deployment error".
Here is the gist of error I get.
npm ERR! weird error 1
install.js: Unable to download msnodesql-0.2.1-v0.10-ia32.msi
Failed exitCode=1, command="D:\Program Files (x86)\nodejs\0.10.21\node.exe" "D:\Program Files (x86)\npm\1.3.11\node_modules\npm\bin\npm-cli.js" install --production
An error has occurred during web site deployment.
npm
My package.js is as follows
{
"name": "application-name",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node app.js"
},
"dependencies": {
"express": "3.4.8",
"jade": "*",
"nconf": "~0.6.9"
}
}
Inside, node_modules, there is also mnodesql folder which I downloaded from GitHub[https://github.com/WindowsAzure/node-sqlserver]
I run the following code too.
node-gyp configure
node-gyp build
I would appreciate any advice you can offer.
Thanks.
AFAIK, node-sqlserver needs C++ environment to compile the source code but there's no C++ compiler in Azure Website. What I did is to compile this module on local machine and upload as part of my source code. I covered this scenario at the bottom of my blog http://wblo.gs/dLo.
Hope this helps.
I've begun using Node.js to make web applications. It's really awesome. I've come across a few modules that I want to incorporate into my build. I can work with the modules in Terminal after a global npm install. When it comes time to add them to my application, I have no idea how to go about placing them in my directory structure and I haven't found any good documentation on this. My typical node.js directory is:
ROOT
Server
server.js
node-modules
Client
index.html
css
-main.css
javascript
-main.js
-jquery.js
My process for installing the modules has been:
I cd into my Server file and run npm install
Then I go to my package.json file and include the module in the dependencies
{
"name": "application-name",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node app"
},
"dependencies": {
"express": "3.1.0",
"jade": "*",
"stylus": "*",
"<node-module-here>": "1.0.x",
},
"engines": {
"node": "0.10.0",
"npm": "1.2.14"
},
}
After that, I head over to the server.js file I add:
module.exports = require('<path_to_node-module_lib>');
When I run functions that are dependent on the modules on the Client side (functions that work in Terminal), I don't receive an error but the function won't run. Because I'm not receiving errors I have no idea about how to debug. If anyone can recognize some fatal flaw in my structure or implementation and can offer some recommendations, I offer my first born.