Currently I am working on online yaml code editor. I use expressjs framework for it. I want to install yamljs module to it. How do I install it? Because following code line cause to an error.
var YAML = require('yamljs');
This is the 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 is the error
Error: Cannot find module 'yamljs'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/home/tharindu/Documents/projects/Group project2/CuubezFinal/app.js:12:12)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
I use webstorm for coding. I have installed yamljs module using
npm install yamljs
could you provide more information like the error text?
Have you tried
to make the module accessible to the node environment?