0% found this document useful (0 votes)
61 views

Node Initialialization

The document details the steps taken to set up and run a Node.js/Express application on a Windows system. It shows installing Node.js and the express-generator, using express-generator to create an Express app scaffold called "myapp", installing dependencies, resolving errors when initially running the app, and initializing a package.json file. The app is then successfully running on port 8080.

Uploaded by

Cedrix Tumlos
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
61 views

Node Initialialization

The document details the steps taken to set up and run a Node.js/Express application on a Windows system. It shows installing Node.js and the express-generator, using express-generator to create an Express app scaffold called "myapp", installing dependencies, resolving errors when initially running the app, and initializing a package.json file. The app is then successfully running on port 8080.

Uploaded by

Cedrix Tumlos
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

Your environment has been set up for using Node.js 10.11.0 (x64) and npm.

C:\Users\ctumlos>npm install express-generator -g

C:\Users\ctumlos\AppData\Roaming\npm\express ->
C:\Users\ctumlos\AppData\Roaming\npm\node_modules\express-generator\bin\express-cli.js

+ [email protected]

added 10 packages from 13 contributors in 6.506s

C:\Users\ctumlos>express myapp

warning: the default view engine will not be jade in future releases

warning: use `--view=jade' or `--help' for additional options

create : myapp\

create : myapp\public\

create : myapp\public\javascripts\

create : myapp\public\images\

create : myapp\public\stylesheets\

create : myapp\public\stylesheets\style.css

create : myapp\routes\

create : myapp\routes\index.js

create : myapp\routes\users.js

create : myapp\views\

create : myapp\views\error.jade

create : myapp\views\index.jade

create : myapp\views\layout.jade

create : myapp\app.js

create : myapp\package.json
create : myapp\bin\

create : myapp\bin\www

change directory:

> cd myapp

install dependencies:

> npm install

run the app:

> SET DEBUG=myapp:* & npm start

C:\Users\ctumlos>cd myapp

C:\Users\ctumlos\myapp>node app.js

internal/modules/cjs/loader.js:583

throw err;

Error: Cannot find module 'http-errors'

at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)

at Function.Module._load (internal/modules/cjs/loader.js:507:25)

at Module.require (internal/modules/cjs/loader.js:637:17)

at require (internal/modules/cjs/helpers.js:20:18)

at Object.<anonymous> (C:\Users\ctumlos\myapp\app.js:1:81)

at Module._compile (internal/modules/cjs/loader.js:689:30)

at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)

at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)

at Function.Module._load (internal/modules/cjs/loader.js:530:3)

C:\Users\ctumlos\myapp>npm install

npm WARN deprecated [email protected]: Jade has been renamed to pug, please install the latest version of
pug instead of jade

npm WARN deprecated [email protected]: Please update to at least constantinople 3.1.1

npm WARN deprecated [email protected]: Deprecated, use jstransformer

npm notice created a lockfile as package-lock.json. You should commit this file.

added 99 packages from 139 contributors and audited 194 packages in 20.521s

found 2 low severity vulnerabilities

run `npm audit fix` to fix them, or `npm audit` for details

C:\Users\ctumlos\myapp>node app.js

C:\Users\ctumlos\myapp>node app.js

C:\Users\ctumlos\myapp>node app.js

C:\Users\ctumlos\myapp>npm init

This utility will walk you through creating a package.json file.

It only covers the most common items, and tries to guess sensible defaults.

See `npm help json` for definitive documentation on these fields

and exactly what they do.

Use `npm install <pkg>` afterwards to install a package and

save it as a dependency in the package.json file.


Press ^C at any time to quit.

package name: (myapp) app

version: (1.0.0) 1

Invalid version: "1"

version: (1.0.0) 1.0.0

description:

entry point: (index.js) app.js

test command:

git repository:

keywords:

author:

license: (ISC)

About to write to C:\Users\ctumlos\myapp\package.json:

"name": "app",

"version": "1.0.0",

"description": "",

"main": "app.js",

"scripts": {

"test": "echo \"Error: no test specified\" && exit 1"

},

"author": "",

"license": "ISC"

Is this OK? (yes) yes


C:\Users\ctumlos\myapp>dir

Volume in drive C is SOE

Volume Serial Number is 4415-8BB5

Directory of C:\Users\ctumlos\myapp

11/05/2018 08:43 PM <DIR> .

11/05/2018 08:43 PM <DIR> ..

11/05/2018 08:43 PM 197 package.json

1 File(s) 197 bytes

2 Dir(s) 182,984,425,472 bytes free

C:\Users\ctumlos\myapp>node app.js

internal/modules/cjs/loader.js:583

throw err;

Error: Cannot find module 'express'

at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)

at Function.Module._load (internal/modules/cjs/loader.js:507:25)

at Module.require (internal/modules/cjs/loader.js:637:17)

at require (internal/modules/cjs/helpers.js:20:18)

at Object.<anonymous> (C:\Users\ctumlos\myapp\app.js:1:79)

at Module._compile (internal/modules/cjs/loader.js:689:30)

at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)

at Module.load (internal/modules/cjs/loader.js:599:32)

at tryModuleLoad (internal/modules/cjs/loader.js:538:12)

at Function.Module._load (internal/modules/cjs/loader.js:530:3)
C:\Users\ctumlos\myapp>npm install express --save

npm notice created a lockfile as package-lock.json. You should commit this file.

npm WARN [email protected] No description

npm WARN [email protected] No repository field.

+ [email protected]

added 48 packages from 36 contributors and audited 121 packages in 11.488s

found 0 vulnerabilities

C:\Users\ctumlos\myapp>npm install http --save

npm WARN [email protected] No description

npm WARN [email protected] No repository field.

+ [email protected]

added 1 package and audited 122 packages in 3.753s

found 0 vulnerabilities

C:\Users\ctumlos\myapp>npm install querystring --save

npm WARN [email protected] No description

npm WARN [email protected] No repository field.

+ [email protected]

added 1 package from 1 contributor and audited 123 packages in 4.157s

found 0 vulnerabilities

C:\Users\ctumlos\myapp>
C:\Users\ctumlos\myapp>npm install request-promise --save

npm WARN [email protected] requires a peer of request@^2.34 but none is installed. You must
install peer dependencies yourself.

npm WARN [email protected] requires a peer of request@^2.34 but none is installed. You
must install peer dependencies yourself.

npm WARN [email protected] No description

npm WARN [email protected] No repository field.

+ [email protected]

added 8 packages from 14 contributors and audited 131 packages in 12.137s

found 0 vulnerabilities

C:\Users\ctumlos\myapp>node app.js

###

### The "request" library is not installed automatically anymore.

### But required by "request-promise".

###

### npm install request --save

###

C:\Users\ctumlos\myapp\node_modules\request-promise\lib\rp.js:23

throw err;

Error: Cannot find module 'request'

at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)

at Function.Module._load (internal/modules/cjs/loader.js:507:25)
at Module.require (internal/modules/cjs/loader.js:637:17)

at require (internal/modules/cjs/helpers.js:20:18)

at C:\Users\ctumlos\myapp\node_modules\request-promise\lib\rp.js:11:16

at module.exports (C:\Users\ctumlos\myapp\node_modules\stealthy-require\lib\index.js:62:23)

at Object.<anonymous> (C:\Users\ctumlos\myapp\node_modules\request-promise\lib\rp.js:10:19)

at Module._compile (internal/modules/cjs/loader.js:689:30)

at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)

at Module.load (internal/modules/cjs/loader.js:599:32)

at tryModuleLoad (internal/modules/cjs/loader.js:538:12)

at Function.Module._load (internal/modules/cjs/loader.js:530:3)

at Module.require (internal/modules/cjs/loader.js:637:17)

at require (internal/modules/cjs/helpers.js:20:18)

at Object.<anonymous> (C:\Users\ctumlos\myapp\app.js:5:21)

at Module._compile (internal/modules/cjs/loader.js:689:30)

at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)

at Module.load (internal/modules/cjs/loader.js:599:32)

at tryModuleLoad (internal/modules/cjs/loader.js:538:12)

at Function.Module._load (internal/modules/cjs/loader.js:530:3)

at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)

at startup (internal/bootstrap/node.js:279:19)

C:\Users\ctumlos\myapp>npm install request --save

npm WARN [email protected] No description

npm WARN [email protected] No repository field.

+ [email protected]

added 39 packages from 41 contributors and audited 193 packages in 11.949s

found 0 vulnerabilities
C:\Users\ctumlos\myapp>node app.js

Express server listening on port 8080

^C

C:\Users\ctumlos\myapp>node app.js

Express server listening on port 8080

hello world

hello world

^C

C:\Users\ctumlos\myapp>node app.js

Express server listening on port 8080

hello world

--save (to save in the json package)

Get the value in the parent of catalog_task


RITM: Value to get the number

GET https://dev27740.service-now.com/api/now/table/sc_req_item?
sysparm_query=sys_id
%3Daeed229047801200e0ef563dbb9a71c2&sysparm_limit=10
sys_id-RITM
parent.sys_id

6eed229047801200e0ef563dbb9a71c2

Request{

Value=6eed229047801200e0ef563dbb9a71c2 for WO

You might also like