npm install issue with meteor custom deployment - node.js

I have used meteor build command to create a deployment bundle .tar.gz which is plain Node.js application.
I extract bundle and run following command to run app:
cd programs/server && npm install
But i am not available to run npm install, it is returning message 'SampleApplication module is not defined' and 'sampleapplication' is name of my application.

Given the error you posted, and the limited information available, I assume you're experiencing capitalization sensitivity from whatever OS your deployment server is on. Windows, Linux, OSX all handle capitalization in file paths differently.
Thus, if you develop on OSX which does not care about capitalization and deploy to a windows server which treats file paths as is you can run into issues with required file paths in your program if you are not careful.

Related

Making node.js code to a executable file in MacOS

I have a nodejs app app.js which I'm able to execute with help of the command line tool (changing to the direction of the app and executing the command
node app.js
before that the application is installed with npm install). To make it easier in the daily use i would like to make the app executable, both parts, the installation as well as the trigger of the app.
The app is for generating a small report, I already tried it with a script where I saved the command node app.js.
You might use pkg.
This command line interface enables you to package your Node.js project into an executable that can be run even on devices without Node.js installed.

Unable to install grpc binaries

I am trying to run a Node.js app on Azure.
To do that, I need to download all node_modules on my local machine, then copy all of them (along with my app) into Azure.
One of the packages in the project is grpc. During the installation, it creates a binary file on my local machine named node-v57-win32-x64\grpc_node.node.
When I try to run the app on Azure it crashes because it can't find a file called node-v46-win32-ia32\grpc_node.node.
As you can see, there are two differences in those filenames.
I couldn't figure out what v46 and v57 stands for. Also, how do I build it for ia32 while I'm on an x64 machine?
In that filename, the "v57" and "v46" refer to Node internal version numbers that match up with Node major versions (for the most part). In this particular case, "v46" corresponds to Node 4.x, and "v57" corresponds to Node 8.x. So, you should be able to force the installation of that binary by installing with the following command:
npm install --target=4.0.0 --target_arch=ia32

Do I need to run the command npm install every time I want to compile my project?

I am currently working on a project at a large company, and according to the project I am working on, every time I want to quickstart the app, I would need to first run the command npm install and then run all the additional compiling instructions, but the problem is that running npm install can take a long time, and that is why I am wondering if it is necessary to run this command every time I make a change to the code, and then want to compile and run it.
What exactly does npm install do? If you could explain to me in terms of how we compile and run java code i.e. javac bob.java && java bob and try to make analogies on that basis, that would greatly help me understand the concept. The way I am currently thinking about it right now is that npm install kind of runs like how javac runs, but I am not sure if that is correct. Thanks in advance!
NPM Install
npm install simply reads your package.json file, fetches the packages listed there from (usually) https://www.npmjs.com/, and sometimes engages in the build steps for those packages.
So you only have to run npm install when you change your package.json file, and need to fetch new dependencies.
Keep in mind that npm install --save <packagename> (or npm install -S <packagename>) will update your package.json and run npm install all in one line!
You can view the results of your npm install inside ./node_modules/.
To compare to java
This might be a helpful resource if you're trying to get stuff done: Getting Started with Node.js for the Java Developer
Javascript is not a compiled language, unlike java. When you invoke javac, the java compiler reads in all your .java files, compiles them to java bytecode, and then writes them to .class files, which can then be bundled together into a .jar for execution.
Javascript doesn't do any of this! When you invoke node foo.js, the node executable wakes up, reads foo.js, and gets to work invoking it line by line**. Node does other cool things, including maintaining an event loop (which allows it to operate "asynchronously", and allows it to be very efficient as a webserver-- it doesn't sit around waiting for requests to complete, it carries forward with the next event in the queue.
Node also performs JIT and optimization, these details allow it to improve the performance of sections code it notices are running "hot".
Note also that node.js uses the V8 javascript engine (also used in Google Chrome). Really everything I've said above is handled by V8.
(** Technically there is a syntax checker which is run first, before execution. But this is not a compile step!)
It is not necessary to do "npm install" each time you want to compile. You just need to do it when you change the dependencies of your project.
NPM basically is the package manager for node. It helps with installing various packages and resolving their various dependencies. It greatly helps with your Node development. NPM helps you install the various modules you need for your web development and not just given you a whole bunch of features you might never need.
When you start an app, it comes with a package.json file. That package contains the list of node_modules you are gonna need. Whenever you enter npm install, what you are doing is to download that list of node_modules. So yeah, you have to download the modules all over again.
#NOTE: In your project, you have a file called package.json. this file is responsible for holding track of your project's dependencies. That's why you have to install it every time#.

Running gulp on project fails because it cannot find an existing file

I'm currently porting a fully working Windows project to an Ubuntu system. After doing the installation of apache/php/mysql/composer/nodejs/nmp I try to run the project. I got the directory where the sources are located (in the web servers location) and I do composer install and the nmp install and they all finish without a flaw. The last step is to call gulp. When I do, I get several of the following errors:
gulp-notify: [Laravel Elixir] Browserify Failed!: Cannot find module
'./components/Colegiados/pagosMatricula/index.vue' from
'/home/web/martilleros/resources/src'
However, the files are there at the specified location. So what am I doing wrong?

Set up an xcode bot to build and deploy a nodejs express server

I am attempting to set up a xcode project and bot that will build a nodejs application on commit from a github repository and restart the server after the build completes. The bot is currently picking up on the repository changes but fails to build correctly.
I am using a xcode external build tool project that uses /bin/bash as the tool path and the working directory is set to the local repository path.
The bot's after integration script is something like,
npm install --production
npm run build
npm run server:restart
I am getting errors like [npm|node] is not recognized.
Just looking for some clarity to what I might be missing or what could be going wrong.
Add this to the beginning of your script and review the output:
which node
set | grep PATH
This will happen if node is not in your path, which may happen because build scripts have a pretty basic environment - they're not running as a normal user. You may need to add it to your PATH at the start of your build script.

Resources