0

I am running the command './loadJson.js' but am facing this issue.

It was working fine until I tried to use this 'underscore.string/slugify'.I gave the npm install for the previous one and from then on am facing this issue.

element.forEach(function(elem)
{
timeStarted=moment(elem.started).fromNow();
if (timeStarted < "14 days ago")
{
console.log(elem.uri);

/data/slave/jenkins/workspace/parseJson/loadJson.js:28 element.forEach(function(elem) ^

ReferenceError: element is not defined at Object. (/data/slave/jenkins/workspace/parseJson/loadJson.js:28:1) at Module._compile (module.js:435:26) at Object.Module._extensions..js (module.js:442:10)

This is the error I'm facing.

7
  • 1
    Can you paste the sample code here.. Commented Mar 9, 2016 at 9:54
  • The error is not node is not defined. Its element not defined. Commented Mar 9, 2016 at 9:59
  • @RoyalPinto I added the sample code Commented Mar 9, 2016 at 10:00
  • What is element here, where have you got that from ? Commented Mar 9, 2016 at 10:01
  • I changed it to element.It's basically whatever I am mentioning before forEach is being shown as not defined. Commented Mar 9, 2016 at 10:03

1 Answer 1

1

First you have to make sure you set environment variable path for node.js got to: Control Panel\All Control Panel Items\System->Adavnce Settings->Environment Variable->user variable: edit

**C:\Program Files\nodejs**

After that open your command prompt and run command:

node -v

This will return current version, It means node working fine

Sign up to request clarification or add additional context in comments.

2 Comments

I checked node -v. It shows the current node version
Now go to your working directory and run npm install express, If your working directing gives node_module after running this command it means your node working fine. And also define variable for foreach like: var your_vaiable = []; your_vaiable .forEach

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.