ExpressJS - Not able to create Basic App - node.js

I installed the express - using npm -g express, And the express is installed globally. which is available on my system in the path of C:\Users\xxxxx\AppData\Roaming\npm\node_modules.
Later I try to create a Basic App, using express in the command of express myApp ( after I mapped a sampleFolder, But the express is not providing any basic app settings.
Instead, it throws the error as :
D:\Tutorials\Angular\Projects - Angular\NG-SERVER>express myApp
'express' is not recognized as an internal or external command,
operable program or batch file.
What is the thing which i do incorrect here? any one help me to create express basic app please?
I am using Windows7 here.
Thanks In advance!

I run this command to fix my issue:
npm install -g express-generator#3
thanks to all,

Related

I am making a website using django and tailwind css. But in Cpanel I am getting this command error of Node Js path. Any suggestions what I can do?

CommandError:
It looks like node.js and/or npm is not installed or cannot be found.
Visit https://nodejs.org to download and install node.js for your system.
If you have npm installed and still getting this error message, set NPM_BIN_PATH variable in settings.py to match path of NPM executable in your system.
Example:
NPM_BIN_PATH = "/usr/local/bin/npm"
For windows user, add
NPM_BIN_PATH = "C:/Program Files/nodejs/npm.cmd"
to settings.py
In order to find out if Node is installed on your hosting environment, you can use:
node -v
If this returns a version, then it is an indicator that there is NodeJS installed by default. And to find out the full path to the node binary, use:
whereis node
OR
which node
Once you got the full path, define it inside the settings.py of your Django.
However, if you still experience difficulties with that, I would strongly recommend finding a managed NodeJS web hosting provider that will natively have NodeJS and their support can help with such questions.

React app throwing error while i am importing docusign-esign module

create a react app
create-react-app demodocusign
Then install docusign-esign using npm.
npm install docusign-esign
Then import docusign in your app.js
const docusign = require("docusign-esign");
or
import docusign from "docusign-esign"
Then start the app
npm start
Then see the console or terminal ,its saying Module not Found Can't resolve 'ApiClient'
Note-Its working in Node express server but if i try to do the same thing in react ,it is throwing error
So the issue is that this is client side code and our node.JS npm package can only be used from the server. You can only make the API calls from your server.
Make sure you have code like this in your .js code:
var docusign = require('docusign-esign');
docusign.ApiClinet // whatever you are doing with it.

Azure Kudu - 'npm' is not recognized as an internal or external command

I have created Easy API in Azure app service. I need to install node modules for the API. When i try to install the node modules, i am getting the below error.
npm' is not recognized as an internal or external command
I suggest you checking if the node and npm paths exist in your system path via
(ls env:path).value.
If not, you could add them into the path variable.
$env.path = "<nodejs path>;$env.path"
$env.path = "<npm path>;$env.path"
Hope it helps you.

Installing NodeAdmin for Node.JS on Ubuntu

I'm a seasoned developer in using the LAMP stack and am trying to switch over to Node.js and play around with it. For database management, I love the flexibility and ease of PHPmyadmin and found the NPM package NodeAdmin to be exactly what I"m looking for in terms of an analogue.
But when trying to install and access nodeadmin, the instructions look like complete Greek to me as someone coming from the Apache environment: https://www.npmjs.com/package/nodeadmin
I ran
npm install nodeadmin
inside the root directory and all looked good. But now I'm unable to access nodeadmin under mydomain.com/nodeadmin as it says I should in the instructions. What directory should I be installing nodeadmin in? What the heck do I do with the code in the "Setup" section of that tutorial?
Thanks in advance for helping break in a newb to his new environment.
Looks like nodeadmin is meant to be run as express middleware. The most basic set up would be to create a new file, let's call it app.js. The content of app.js should be:
var express = require('express');
var app = express();
var nodeadmin = require('nodeadmin');
app.use(nodeadmin(app)); //here is where you add the middleware
app.listen(80);
After that, go to directory where you created app.js and run the following commands
npm install express
npm install nodeadmin
node app.js
It looks like nodeadmin is express middleware, so you don't install it standalone. Instead you include the middleware in your website application and then access it via the same host on the /nodeadmin path.
I guess it uses the mysql config from your app to connect to the same db so you can use it to manage the application data.
var nodeadmin = require('nodeadmin');
app.use(nodeadmin(app));
express is a web framework for building nodejs apps. The nodeadmin module you're using can only be used as part of an express application. You'll need to use something else if you want to run it standalone.
A quick google turns up Express Admin. Looks like it's built using express, but doesn't need to be installed as part of an express app. You could give that a try. There may be better alternatives
I ended up getting more errors after following the above answers and am giving up and installing PHPmyadmin (which I realize I should have done from the beginning). Thanks for the answers.

Node.JS Express Authentication App Creation TypeError

I'm working through a tutorial on Node.js that begins with a simple authentication program. This is the second time I'm doing this tutorial, and the first time, everything worked fine. However, upon uninstalling node and starting from scratch (installing node.js and express via npm), the instantiation of authentication errors out as below.
program.confirm('destination is not empty, continue? ', function(ok){
^
TypeError: Object #<Command> has no method 'confirm'
at C:\Users\Kyle\AppData\Roaming\npm\node_modules\express\bin\express:251:15
at C:\Users\Kyle\AppData\Roaming\npm\node_modules\express\bin\express:382:5
at Object.oncomplete (fs.js:107:15)
I'm on a windows machine, running Node.js v0.10.20 and express v3.4.1.
Is this a result of the inconsistent -g flag install referenced here?
EDIT: Express initializes apps fine in other directories, even those with the subdirectory Node.js. The path to this problem folder is C:\dev\Node.js\ ...any idea why Express refuses to initialize something in this folder?
Try:
Remove your directory
"C:\Users\Kyle\AppData\Roaming\npm\node_modules\express\node_modules\commander".
Install node module "commander 1.3.2" globally.
Command line: $ npm install -g commander#1.3.2
Run "express" again.
It seems to be the problem referred to the new version(2.0.0) of the commander module.
It works on my mac.
Good luck~
I had the same problem. Rather than fix the problem, you can fix the source of the problem (not specifying an empty directory). In my case I was specifying an empty directory, but it was associating that with the previous switch.
I had to change:
node_modules/.bin/express -s -e -c ./server
To:
node_modules/.bin/express -s -e -c css ./server
Otherwise it thought the server path was the type of css to use and was setting the code path to '.'

Resources