On my mac, I have the following:

test
test/test.js
test/node_modules <--<< Created after running 'npm install xls-to-json'
data.xls
data.json <--<< Created after running 'node test.js'

Here's the script, copied from what you have:

var node_xj = require("xls-to-json");

node_xj(
{
input: "data.xls",
output: "data.json"
}, function(err, result) {
if(err) {
console.error(err);
} else {
console.log(result);
}
}
);

So it all looks to be working.

Start again.

Create a new folder, go into it. Run 'npm install xls-to-json'. Place your
code in a file in the new folder. Run it with 'node your-script.js'.

What happens?

A



On 2 September 2014 19:38, HansPeterSloot <[email protected]> wrote:

> When I put the code in the same directory as the node executable the error
> disappeared.
>
> But I consider that  more or less 'dirty'.
> How can I separate the code from the executables?
>
> Op zaterdag 30 augustus 2014 23:09:46 UTC+2 schreef Tadeu Zagallo:
>>
>> I think the module should be installed on the same folder as your
>> application.
>>
>>
>> Try moving the `node_modules` folder to `c:\cygwin64\home\nl19856\`
>>
>> []s
>>
>>
>> On 29 August 2014 15:02, HansPeterSloot <[email protected]> wrote:
>>
>>> Hello,
>>>
>>> I have installed xls-to-json but it does not seem to work.
>>>
>>> How can I fix this?
>>>
>>> Regards HansP
>>>
>>> C:\Program Files\nodejs>npm install xls-to-json
>>> [email protected] node_modules\xls-to-json
>>> ├── [email protected]
>>> └── [email protected] ([email protected], [email protected], [email protected], [email protected])
>>>
>>> C:\Program Files\nodejs>node c:\cygwin64\home\nl19856\xls2json.js
>>>
>>> module.js:340
>>>     throw err;
>>>           ^
>>> Error: Cannot find module 'xls-to-json'
>>>     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> (c:\cygwin64\home\nl19856\xls2json.js:1:75)
>>>     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 Function.Module.runMain (module.js:497:10)
>>>
>>>  --
>>> Job board: http://jobs.nodejs.org/
>>> New group rules: https://gist.github.com/othiym23/9886289#file-
>>> moderation-policy-md
>>> Old group rules: https://github.com/joyent/node/wiki/Mailing-List-
>>> Posting-Guidelines
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "nodejs" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> To post to this group, send email to [email protected].
>>>
>>> To view this discussion on the web visit https://groups.google.com/d/
>>> msgid/nodejs/9fffa9f3-c96f-4ece-9239-2f65d8793707%40googlegroups.com
>>> <https://groups.google.com/d/msgid/nodejs/9fffa9f3-c96f-4ece-9239-2f65d8793707%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>  --
> Job board: http://jobs.nodejs.org/
> New group rules:
> https://gist.github.com/othiym23/9886289#file-moderation-policy-md
> Old group rules:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> ---
> You received this message because you are subscribed to the Google Groups
> "nodejs" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/nodejs/46a97a55-f339-4f87-9337-eeeb1ad0f30d%40googlegroups.com
> <https://groups.google.com/d/msgid/nodejs/46a97a55-f339-4f87-9337-eeeb1ad0f30d%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/CAH368SSe8zbQT2jW_X%3Dks2CWTp4VRGWwAEOTMGU1Zgd8bE8LrQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to