julianrojas87 / ttl-merge

A CLI to merge multiple turtle (RDF) files into one file
MIT License
1 stars 2 forks source link

Issue with fs #2

Open michal-josef-spacek opened 2 years ago

michal-josef-spacek commented 2 years ago

When I installed ttl-merge, command is failing with:

> ttl-merge -i oai%3Aoai.bn.pt%3Abibliografianacional%2F1000159.ttl oai%3Aoai.bn.pt%3Abibliografianacional%2F1000717.ttl
/usr/local/lib/node_modules/ttl-merge/index.js:3
import fs from 'fs';
       ^^

SyntaxError: Unexpected identifier
    at Module._compile (internal/modules/cjs/loader.js:723:23)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)

I was looking to package-lock.json and there is no fs module. How could i fix this?

julianrojas87 commented 2 years ago

Hi Michal,

Which version of Node.js are you using? (check with node -v in the command line). Judging by the error you are getting it seems you have a version that does not support ES6 modules. Also, fs is a Node.js native library and for this reason it won't show as a dependency in package-lock.json

michal-josef-spacek commented 2 years ago

@julianrojas87

woman:~> node -v
v10.24.0
michal-josef-spacek commented 2 years ago

Still is possible to install and same error.

julianrojas87 commented 2 years ago

@michal-josef-spacek so your version of Node.js needs to be updated to v13 or higher to run this tool.

I also added the engines declaration and enable its strict mode to fail when attempting to install on older versions of Node.js.

Let me know if it works for you.

michal-josef-spacek commented 2 years ago

Still same (instalable, not working) on my version. (I understand, that i need v13 and higher)

julianrojas87 commented 2 years ago

You are right is still possible to install, although a warning is shown: image

I will take a look at it. Were you able to run it in v13 or higher?

michal-josef-spacek commented 2 years ago

@julianrojas87 Probably issue with npm

woman:~# npm install -g ttl-merge
npm WARN npm npm does not support Node.js v10.24.0
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8, 9.
npm WARN npm You can find the latest version at https://nodejs.org/
/usr/local/bin/ttl-merge -> /usr/local/lib/node_modules/ttl-merge/index.js
+ ttl-merge@0.2.2
updated 1 package in 0.394s

Thanks for help, i will check on higher version.