Meteor 0.9.0 bundle and deploy throw errors - node.js

I upgraded to Meteor 0.9.0 today. I use meteor bundle filename to bundle my application and upload to AWS. When I try to start it on AWS, I get
wrong ELF class: ELFCLASS32
This is a known problem with fibers/bcrypt, so I used to go to bundle/programs/server/node_modules, remove the fibers and bcrypt folders and reinstalling them (npm install).
However, currently the node_modules directory does not exist anymore... When I am trying to start nodejs I get
Error: Cannot find module 'underscore'
I tried to manually add the modules with npm install, and even got the server to eventually run, but the client didn't load and the console error was about
Spacebars undefined
(I don't have the exact Spacebar issue)
I know that Meteor 0.9.0 is very new, but if you have advice I would really appreciate it!

You don't need to remove any folders, simply do this in the bundle directory (output of the untarred meteor bundle):
cd bundle
cd programs/server
npm install
Meteor 0.9.0 makes sure it puts up all the node_modules which don't contain binaries, and creates a package.json for npm install for both bcrypt and fibers
Since you've removed the npm modules in node_modules you may have to recreate the bundle from scratch to get them back.
For the Spacebars undefined issue its very likely that you have a package in your project that is not compatible with Meteor 0.9.0. You can find out which one it is by checking your server logs. Though it is not compatible, your app will still run.
This may be boostrap-3, though it may not be. If it is you can meteor remove mrt:bootstrap-3 and meteor add mizzao:bootstrap-3.

Akshat, you are a lifesaver! Based on your answer I eventually managed to figure it out! For the benefit of others, I want to document what eventually worked:
First, I had to manually remove all the old packages from my Meteor project (seems that it didn't do it automatically). In particular, I removed
iron-router
which was the pre-Meteor 0.9 version and installed
iron:router
which is the post-Meteor 0.9 version. (I had to do a similar process of removing and adding different packages for 2-3 other packages too).
Then, once I bundled and unpacked on AWS, I did what Akshat said about npm install in bundle/programs/server. In addition, I had to manually remove the original bctypt by deleting the folder
bundle/programs/server/npm/npm-bcrypt
as otherwise I got an ELS error

If you're getting this error with Meteor-Up. Updating the package should fix it.
npm update mup -g

Related

NPM not installing node module

I have an angular project that comes with a package.json file and all the dependencies listed within, but each time I run "npm install", in the terminal, the packages appear to be downloading properly and a node module folder is created in my root folder, but at a certain stage the installation stops without an error message and the generated node module folder disappear from my project. please what do I do?
I can't reproduce your situation, somehow this may not fitable for you.
But I suggest re-install node.js to make sure npm install work correctly.
This link will help to find what version of node.js for you, based on you angular version.
Compatibility list for Angular/Angular-CLI and Node.js
Also, It would be good to manage node.js via NVM(Node Version Manager).

Webpack failed to compile react code after upgrade to node v8 (on Ubuntu 16)

After upgrading from node v7 to node v8, webpack failed to compile my react code.
It said that some node_modules are not found. Note: This issue does not happen on Windows.
I tried several ways from refreshing node cache & npm_modules to double-checking $NODE_PATH, but still failed to make it work. Looks like an compatibility issue of node v8 and webpack (or some ES6 syntax).
Temporarily I reverted back to node v7 to make it work.
Does anyone encounter this issue?
When you install a new Node version then you need to make sure that you install all modules that you want installed globally using that new version (you need to have both node and npm in your PATH with that new version first before any other version of node and npm that you might have in your PATH or this will likely not work as expected). Then you need to rebuild all locally installed modules (you may need to remove node_modules directory in some cases to make sure that everything is built from scratch).
One issue that is quite common when you have multiple Node versions installed from the binary packages (using either binary tarballs or nvm etc.) is that the npm that gets installed has a general shebang line #!/usr/bin/env node instead of a specific path like #!/opt/node-v8.0.0/bin/node which would be the case if you built Node from the sources yourself.
This means that you can sometimes go into trouble by running npm with global path that would use the wrong version of Node, leading to some issues that can be hard to notice.
The least problematic Node installation in my experience is building it from sources, installing in a versioned directory and explicitly adding it to PATH before installing the modules globally, before local npm install and before running the project that you want to be using that specific Node version. That way you can make sure that you're not using any files that could be left overs from older versions, like would be the case with installing under a common /usr/local prefix.
You can take a look at my tutorial for more details and other options to install Node:
https://gist.github.com/rsp/edf756a05b10f25ee305cc98a161876a
In general what you described is usually caused by clashing installations of Node.

Error with 'babel-runtime' while trying to serve a Meteor app

I have recently been getting off the ground with Meteor and React. I followed the tutorial on the Meteor website with no problem.
Then I tried creating another project, trying to follow another tutorial (for an older version of Meteor). Somewhere along the line, Meteor started throwing up obscure errors. After trying to start fresh again, I ended up reinstalling Meteor and it stopped complaining.
However, I'm getting the same problems, again. Specifically, after creating a brand new project:
meteor create myproject
cd myproject
meteor
The server throws up the following error:
[...]
W20161109-03:53:42.862(1)? (STDERR) Error: The babel-runtime npm package could not be found in your node_modules
W20161109-03:53:42.862(1)? (STDERR) directory. Please run the following command to install it:
W20161109-03:53:42.863(1)? (STDERR)
W20161109-03:53:42.863(1)? (STDERR) meteor npm install --save babel-runtime
[...]
I do what I'm told and attempt to install babel-runtime package. The server manages to successfully get off the ground, but it then throws up the following error at run-time:
Uncaught Error: Cannot find module 'babel-runtime/helpers/slicedToArray'
at Function.require.resolve
This is all still working off a freshly created project, with no extra packages installed or code changed. I have tried looking online for solutions but, while there are lots of references to bugs that have been fixed, I haven't found anything. A couple of (questions)[Babel - Error: Cannot find module 'babel-runtime/helpers/typeof' on StackOverflow have suggested the following:
Reinstalling the NPM modules
rm -rf node_modules
meteor npm install
Updating NPM
meteor npm update -g npm
I am using Meteor 1.4.2, NPM 3.10.9, Ubuntu 16.04.1.
I was having the same issue. After a little digging, found this: https://github.com/meteor/meteor/issues/8019
* Installing the `babel-runtime` npm package in your application
`node_modules` directory is now required for most Babel-transformed code
to work, as the Meteor `babel-runtime` package no longer attempts to
provide custom implementations of Babel helper functions.
Consider trying it out by using the latest release candidate (not officially released yet):
meteor update --release 1.4.2.1-rc.1
And then:
meteor npm install --save babel-runtime
After upgrading to 1.4.2.1-rc.1 (and then subsequently upgrading to 1.4.2.1 this morning 11/9), the error was resolved.
Try adding package.json file inside your project directory and then run
meteor
npm install --save babel-runtime
in the command line.
You may have whitespace in your project name. All that you have to do is create another project without whitespace in the name. I know that it's quite difficult to detect the cause from the error message, but it is what it is.
I recently faced this issue with meteor 1.11.1 and the solutions here did not work. Turns out I had whitespaces in my project name (Ghughu Server V2) and all I had to do is create another one without the spaces (GhughuServerV2).
P.S. It works fine even if you have whitespace in the path to your project, you just can't have whitespace in the project name. Also, just renaming the directory doesn't work. Either you have to create a brand new project or change some configuration inside (which seems impractical if you're working in a newly created project).

Cannot find module dtrace-provider

I have a simple nodejs application that is throwing "Cannot find module './build/Release/DTraceProviderBindings'". I look it up online and it looks like that a lot of people are having the same problem when using restify on windows (which is my case, I'm using restify on windows 10). Apparently, dtrace-provider is a optional module for restify and there is no version of it for windows. So, what I tried so far:
Update node to v6.2.0;
Uninstall all modules and run npm install --no-optional;
Uninstall only restify and run npm install restify --no-optional;
And my most desperate move npm install dtrace-provider.
Everything I tried where found on github issues, I've seen same error on OSX users with other modules. Not sure what else to try.
Note: This exception does not stop my application, not even prints the error on the console, I just notice that this was happening using the debugger, in other words, my application runs fine, but this keeps happening on the background.
List of other modules I'm using:
"dependencies": {
"restify": "latest",
"request": ">=2.11.1",
"cheerio": ">=0.10.0",
"xml2js": ">=0.2.0",
"botbuilder": "^0.11.1",
"applicationinsights": "latest"
}
This worked for me after switching to Node 6.1 (and when re-installing node modules didn't work):
Install and save dtrace-provider
$ npm install dtrace-provider --save
Delete 'node_modules' folder
Re-install node modules
$ npm install
I found this thread before combining your attempts with another solution on the Github project issues for restify (https://github.com/restify/node-restify/issues/1093) and simplified best as possible.
I recently ran into this error as well on node 6.11.1.
I ran npm rebuild dtrace-provider and that resolved the problem.
The restify team followed an approach of trying to load the module by requiring it on a try/catch block. You should just ignore the exception.
I had success with the following (elaborate) sequence:
Adjust my path to not have spaces
rm -rf node_modules
rm -rf ~/Library/Caches/node-gyp/
npm cache clean --force
V=1 npm install -S dtrace-provider#0.8.8 --python=python2.7 (repeat this step, resolving as you go, until the install is completely successful … if it fails, check the version - I had rogue dtrace-provider#0.6.0 building at one point)
npm install
At this point everything should have installed cleanly, and I was congratulating myself on a job well done. Then I executed my code and still got the DTraceProviderBindings error. The cause was nested dependencies with the wrong version of dtrace-provider (especially bunyan).
To confirm, do npm list | grep dtrace -B6.
If there's anything lower than 0.8.8, edit package-lock.json, following the method in How do I override nested NPM dependency versions?. Replace requires with dependencies for dtrace-provider and update the version.
Back round to get everything clean: rm -rf node_modules
Then, again, npm install --python=python2.7
I had to iterate round npm list a few times because I thought I'd caught everything and I hadn't.
The key points were to use the required version of python, have a unix-friendly path, and hunt down all nested dependencies. The python version issues gave a big messy error, the space issue gave a much more missable error.
I know this is an old issue but I wanted to comment on it in case anyone else has the same issue I had.
My issue was caused by having parentheses in my path.
/users/karlgroves/Dropbox (Personal)/foo/bar/bat/project...
Moving the project to a path without the parens worked for me.
You'll need to wipe out node_modules and reinstall again.
I recently ran into this error as well on node v8.8.1
as #Derek mentioned, I ran npm rebuild dtrace-provider and that resolved the problem.
tl;dr; dtrace-provider utilized node-gyp which required python version >= 2.5 and NOT 3.5
I had this issue on OSX and found a post that showed using environment variable
V=/Users/your_user/your_project npm i dtrace-provider
This let me know that there was a dependency on node-gyp that was failing to build...Once I knew the issue was with this module was able to focus my attention at troubleshooting node-gyp.
This led to some log output indicating that my python version 3.5 was unsupported and it required version >= 2.5.
Went and downloaded python 2.7.x and checked /usr/bin/python 2.7.x to ensure it was there. Uninstalled the node module that was ultimately requiring this module, then used npm cache clean then reinstalled the module and this time it appeared to pick up the right python version to be able to build.
Hope this helps someone =)
I have tried many suggestions but get the same error again.
Finally, I found the correct way to solve this question.
Go the node.js website and download the latest version of node.js pkg.
After installed, reinstall your software, everything will be ok.
i managed to get this working by running this command
npm install --python=python2.7

Can no longer deploy a webapp using Yeoman, Grunt and Bower even after reinstalling

I have deployed many webapps using Yeoman, Grunt and Bower. Recently, though, when I ran yo webapp, and opted in for SASS, although it built successfully, it gave the following error in the top right corner of my screen (MAC OS 10.10.5):
(Expanded message):
I could still run the webapp with grunt serve, and it was functioning, although whenever I tried to change the relevant path in my main.scss, something would automatically change it back upon saving, and the above error message would return.
In an effort to resolve this, I tried reinstalling npm, node, bower and grunt. After no effect, I tried completely uninstalling node and npm as per this answer, and then reinstalling from fresh. My npm version is 2.14.3 and my node version is 4.1.0.
Now, I am completely unable to deploy a webapp using yo webapp. Here is the error, the warning seems to be related to Bower:
There are similar problems when running other webapps, such as the official angular webapp.
How can I resolve this situation?
It seems like the bower install step didn't go through (in both cases):
before you reinstall: it couldn't find bootstrap scss file (the bower install might have fail on this dependency)
after you reinstall: it cannot find any bower packages.
Try to run bower install.
You'll find out some errors (like you're behind some proxy or your git clone is failing ...)
If you still have a file import problem: In app/styles/main.scss, remove the comments (bower:scss and endbower).

Resources