Nodejs cannot find module './layer' using express - node.js

I'm using nodejs with express and request. When I run it locally (on windows), it works, but when I upload it to my server it doesn't. I'm using visual studio with gitbucket and I also selected that visual studio should publish the files in the node_modules directory. I'm using the newest version of express (npm install express).
I don't know what this message is about because there is no directory 'layer' (although it works locally).

layer.js is required by express here: https://github.com/strongloop/express/blob/master/lib/router/route.js#L6
Make sure you're properly npm installing on your remote server.

Related

How to run angular Application without node.js

I want to create the Angular application using Visual Studio 2019 Angular template in Asp.net core but without Node.js as External tool installation. I found that NuGet package manager also providing Node.js and NPM Packages for building Angular app.
So I created the asp.net core projected and selected Angular Template and add NuGet Node.js 5.3.0 that too is saying in readme.txt "Node.js itself is deployed by NuGet, so there is no need to install it locally on dev machines or build servers."
But when I tried to run the angular project then build is failing.
If anyone knows the solution with exact steps so please help me on this.
There is one extra step is required after the Nuget Node.js package installed in the project, which is missing in the node.js document.
Step: Add node.js installed path in PATH Environment Variable (One-time activity per dev system)
e.g: set PATH=%PATH%; C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Microsoft\VisualStudio\NodeJs
or node.js install path can be set manually in the PATH Environment Variable

Visual Studio Installer is not installing node.js

In Visual Studio Installer, I selected the Node.js development option. It runs successfully. But, if I try to run cmd node -v. It tells me node does not exist.
I tried a few other things including uninstalling and reinstalling the Node.js development option in VS Installer. Plus installing the latest version of node from the website.
However, when I try to run the pre-packed Angular solution that comes with VS 2017 I have issues. The solution will not even start.
The best I have been able to do is install Node 6.10.3. Once I do that, the web site comes up. But, I get a JavaScript error in the vendor.js file. I am able to continue but I get this error when I try navigate to another menu item. Plus the Hot Module Replacement does not seem to be working. (It does not automatically recompile my TypeScript file if I made a change).
I think the key is getting the Node.js development option installed correctly since I am able to run the pre-packed Angular solution on another PC and the Hot Module Replacement works fine.
Please let me know if anyone has any ideas on how to resolve.
I had a similar, if not the same, issue. Check the Visual Studio installation directory (2017 Professional in this case) for Node:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Microsoft\VisualStudio\NodeJs
If the executable is there, add the directory to your PATH.

NodeJS project type is missing from PhpStorm

I am trying to setup Express.js project in PhpStorm IDE.
Here are things I've done:
Installed node and npm
Installed nodejs plugin in PhpStorm
When I try to create new project node js express app type is missing from the project list.
PhpStorm version: 10.0.0
OS: Windows 8
It's there for me:
Something must be wrong with NodeJS plugin (incompatible version, etc.). I'd suggest creating a support ticket

Electron Js: Unable to install using .msi because the path is too long

I have created a package of electron application by using electron-packager and created MSI project using Visual studio setup project.
Problem
While installing the application I am getting the following error:
I just cannot rename the file or change the location as its a part of node modules.
Please help and suggest what should I do.
You need to package your app into an archive by passing the asar option to electron-packager, that will allow you to avoid the path limit issues and speed up your app startup on Windows.
unless you run latest, you should update node and npm, then rebuild the package.
In npm#3 they worked about that specific issue to flatten the dependency storage folders as much as possible.

How does someone debug Sails.js code in Visual Studio?

I'm currently trying out Node.JS and using Visual Studio Community with Node.js Tools as my primary IDE.
If I would create an Express application using this interface:
Then I would hit F5, my Express application would start and I'd see this nice debug window:
However, if I install Sails.js using npm -g install sails, I no longer see this debug window in my test Sail.js app (if I create one in my Visual Studio), nor in Express app.
My application would start as expected, except that I can't see debug window anymore.
Debug window comes back only if I do following:
Remove Sails from my machine using npm -g uninstall sails
Reinstall node.js
How do I get debug window if I have Sails installed? I'd like to have it for both Express and Sails applications.
Ran into a similar issue of running Sails application inside Visual Studio. Here's how I got my project properly running in Visual Studio, in case any stumbles on that question.
Create Create Blank Node.JS Console Application in the VS
In another folder outside of your project initialize your sails app (if you haven't already), e.g. sails create appName. If you already know your API controllers/models, it's a good idea to create them right now. If not, you'll have to do it manually rather than using sails generate api
IMPORTANT: In Sails project folder, remove node_modules, in my case existing node modules were throwing VS npm off the track
In the visual studio, right click on your project, go to Add > Add Existing Folder...
Select your folder with Sails Application
Once it's imported, you'll notice that you have a folder with sails application that also has app.js. Select all the contents of sails project and move them a level up to your root. It should replace app.js, package.json & readme.
Right click on npm, select Install missing packages...
After that, right click on you app.js file and select it as start js file
Run/Debug the application. It should work just fine.
Hope it helps.

Resources