node.js - how to install new nodejs modules to expressjs project? -
currently working on online yaml code editor. use expressjs framework it. want install yamljs module it. how install it? because following code line cause error.
var yaml = require('yamljs');
this code segment
var express = require('express'); var path = require('path'); var favicon = require('serve-favicon'); var logger = require('morgan'); var cookieparser = require('cookie-parser'); var bodyparser = require('body-parser'); var routes = require('./routes/index'); var users = require('./routes/users'); var yaml = require('yamljs'); var app = express(); // view engine setup app.set('views', path.join(__dirname, 'views')); app.set('view engine', 'jade');
this error
error: cannot find module 'yamljs' @ function.module._resolvefilename (module.js:338:15) @ function.module._load (module.js:280:25) @ module.require (module.js:364:17) @ require (module.js:380:17) @ object.<anonymous> (/home/tharindu/documents/projects/group project2/cuubezfinal/app.js:12:12) @ module._compile (module.js:456:26) @ object.module._extensions..js (module.js:474:10) @ module.load (module.js:356:32) @ function.module._load (module.js:312:12) @ module.require (module.js:364:17)
i use webstorm coding. have installed yamljs module using
npm install yamljs
could provide more information error text?
have tried
npm install yamljs
to make module accessible node environment?
This post is more informative. Thanks for sharing this valuable information.
ReplyDeleteLeadership Programs
Management And Leadership Training