I'm trying to develop an Abstract Syntax Tree program in JavaScript. I'm using Jet brains IDE for development. When I run the program, i get the error Cannot find module esprima. The nodejs settings are perfect and, I don't think there is any problem with it. Please find the code snippet below. In one article, I saw that esprima module is present in the nodejs. Please help. Thank You.
var esp = require('esprima');
Check your project's node_modules
directory for esprima
. If it is not there try to install it using the following command in terminal,
From your command prompt terminal, change your directory to your project's root directory.
Use WinKey + R
to run command prompt. Then run cmd
, and in cmd execute change directory command.For example, if your project is in C
drive then,
C:
This will change to C: drive, then locate your project directory.
cd project_directory
Change project_directory
with yours. Then install module using,
npm install esprima
Otherwise try to update it using,
npm update esprima