Running gulp on project fails because it cannot find an existing file - node.js

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?

Related

Problems with getting started with node.js and puppeteer

I am quite new to programming and today decided to attempt and create a node.js and puppeteer project with the purpose of scraping website into a .txt file. I ran into issues straight away since for the most part I have no idea what I'm doing. After installing node.js and puppeteer, I was guided by some videos and articles I found to create my first project. In the command prompt using mkdir and later cd I was able to create and access the new directory, but I started running into problems with npm init. It only places the file package.json in the repository, but there isn't a package-lock or node_modules file anywhere. No idea what they do but thought this was a problem. When I open cmd and try to run the app by typing node app.js it returns Error: Cannot find module 'C:\Users\emili\app.js' along with some other gobble. What should I do, to be able to run the simple application I wrote?
It seems that you are missing some key knowledge on how NodeJS works, but in order to fix your issue (for now), you will need to take a few steps.
First, in your working directory (where the package.json is), you'll need to install your modules.
Run npm install puppeteer. This will do two things, create the node_modules folder and create the package-lock.json file.
Create a file named app.js (either manually or by running the command touch app.js) in your working directory, and put the following content inside of it:
console.log('Hello, World!');
Save the changes to app.js and then run node app.js in your terminal. You should see Hello, World! output to the terminal.
The reason npm install puppeteer created the node_modules folder and the package-lock.json file is because they weren't needed beforehand.
When you run npm install PACKAGE_NAME, you're installing a module (otherwise known as a package), thus it creates the node_modules folder so that it will have a place to put the module so that your code can access it. It also creates the package-lock.json file, which is used to track the module versions inside of your project.
With this information, I request you go back to the tutorial you were originally following and try going through it again and attempting to understand each of the core concepts before writing any real code.

NodeJs Plugin Installation not found in Jenkins/configure

I am trying to configure Jenkins to build my code using NodeJS Plugin. I have installed NodeJS plugin but NodeJS Installation are not available in System Configuration.
ManageJenkins -> Configure System -> NodeJS installation (not
available)
I am running Jenkins on localhost.
What can I do to resolve this issue?
Have you installed and followed the instruction mentioned in node.js plugin? It is quite straight forward:
After installing the plugin, go to the global jenkins configuration
panel (JENKINS_HOME/configure or JENKINS_HOME/configureTools if
using jenkins 2), and add new NodeJS installations For every Nodejs
installation, you can choose to install some global npm packages.
Now, go to a job configuration screen, you will have 2 new items :
On the "Build environnment" section, you will be able to pick one of
the NodeJS installations to provide its bin/ folder to the PATH.
This way, during shell build scripts, you will have some npm
executables available to the command line (like bower or grunt)
Go to a job configuration screen, you will have 2 new items : On the
"Build environnment" section, you will be able to pick one of the
NodeJS installations to provide its bin/ folder to the PATH. This
way, during shell build scripts, you will have some npm executables
available to the command line (like bower or grunt)
You have to goto "/pluginManager/advanced" and run "check now" so that it will check the nodejs site and do the global install.
This will solve your problem

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

npm install issue with meteor custom deployment

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.

Compiled node.js module not getting correct library path when copied to different machines

My problem is a little complicated but I'll try:
I have a node.js application that needs to be completely prebuilt and bundled alongside standalone node.js (specifically 4.4.5 LTS), zipped and deployed to offline CentOS 6/7 machines, meaning I cannot do npm install, and no gcc/g++/python so I cannot do things like node-gyp rebuild.
Everything is working correctly except this module: ibm_db.
It's compiled with node-gyp after downloading the db2 cli drivers, but basically it's supposed to work like the regular DB2 client except all its dynamic libraries, binaries etc. are inside the module path itself (node_modules/ibm_db/installer/clidriver).
If I deploy the bundle (which includes all node modules in the tarball, including ibm_db) to another machine, it's probably going to sit on a different path from the machine on which I built the bundle. When I try to run the app like this: ./node app.js (here node is a symlink to the standalone node binary inside the unpacked bundle) i get this error:
Error: libdb2.so.1: cannot open shared object file: No such file or directory
Now, I can clearly see that libdb2.so.1 is inside node_modules/ibm_db/installer/clidriver/lib but the paths in bindings.gyp all use the original paths on the build machine which don't match, so I assume this is where the problem lies.
I can easily just add that path with ldconfig and it would work, however the user profile installing the app will not have superuser access so it's not a real option.
I tried setting the environment variable LD_LIBRARY_PATH but node.js deletes this entry from process.env on startup, and even if I programmatically set it like process.env.LD_LIBRARY_PATH='...'; it doesn't seem to do anything.
Is there any way to modify the library path for a compiled module without recompiling/rebuilding it? If it's possible I would assume that would be the easiest solution, but I couldn't find a way to do it.

Resources