RubenVerborgh / SPARQL.js

A parser for the SPARQL query language in JavaScript
Other
344 stars 67 forks source link

errors executing a SPARQL query from command line #30

Closed seralf closed 8 years ago

seralf commented 8 years ago

Hi in order to be able to do some testing on the SPARQL parser from an angularjs app, I'm trying to regenerate the library on a ubuntu virtual machine.

Before executing browserify, I'm trying the command line version. Basically I'm following the steps:

git clone https://github.com/RubenVerborgh/SPARQL.js.git
cd SPARQL.js/
sudo npm -g install

and everything compiles fine, but trying to execute a query locally I've got the following error:

$ bin/sparql-to-json queries/artists-ghent.sparql
module.js:442
    throw err;
    ^

Error: Cannot find module './lib/SparqlParser'
    at Function.Module._resolveFilename (module.js:440:15)
    at Function.Module._load (module.js:388:25)
    at Module.require (module.js:468:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/vagrant/dev_src/SPARQL.js/sparql.js:1:76)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:458:32)
    at tryModuleLoad (module.js:417:12)
    at Function.Module._load (module.js:409:3)

any suggestions?

RubenVerborgh commented 8 years ago

Can you run sudo npm install instead (without the -g for system-wide)?

seralf commented 8 years ago

yes sorry, same output

2016-07-08 19:35 GMT+02:00 Ruben Verborgh notifications@github.com:

Can you run sudo npm install instead (without the -g for system-wide)?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/RubenVerborgh/SPARQL.js/issues/30#issuecomment-231422986, or mute the thread https://github.com/notifications/unsubscribe/AAFYfAqCuiw3Fw0aiZxfvwHvcBk0Z4OOks5qTopXgaJpZM4JH4H7 .

RubenVerborgh commented 8 years ago

Sorry, I can't reproduce. Here are the steps I followed:

git clone https://github.com/RubenVerborgh/SPARQL.js.git
cd SPARQL.js/
npm install
bin/sparql-to-json queries/artists-ghent.sparql

Works for me.

What does npm install give as output? What is your Node.js version? (Your error message is a symptom of an unsuccessful npm install.)

seralf commented 8 years ago

hi thank you for the support

I was testing it at work on a windows machine (win10) with latest node, then on an ubuntu VM with latest node again.

Now I'm testing on my laptop at home (ubuntu):


git clone https://github.com/RubenVerborgh/SPARQL.js.git
cd SPARQL.js/
sudo npm install
bin/sparql-to-json queries/artists-ghent.sparql```

I have to use sudo, but it's probably some strange config on my machine.
Anyway the outputs are:

$ sudo npm install

npm WARN deprecated jade@0.26.3: Jade has been renamed to pug, please install the latest version of pug instead of jade npm WARN deprecated graceful-fs@2.0.3: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree. npm WARN deprecated minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue npm WARN cannot run in wd sparqljs@1.1.4 ./build (wd=~/LDF/SPARQL.js) mocha@1.21.5 node_modules/mocha ├── escape-string-regexp@1.0.2 ├── growl@1.8.1 ├── diff@1.0.8 ├── commander@2.3.0 ├── debug@2.0.0 (ms@0.6.2) ├── jade@0.26.3 (commander@0.6.1, mkdirp@0.3.0) ├── mkdirp@0.5.0 (minimist@0.0.8) └── glob@3.2.3 (inherits@2.0.1, graceful-fs@2.0.3, minimatch@0.2.14)

jison@0.4.16 node_modules/jison ├── jison-lex@0.3.4 ├── lex-parser@0.1.4 ├── ebnf-parser@0.1.10 ├── nomnom@1.5.2 (colors@0.5.1, underscore@1.1.7) ├── esprima@1.1.1 ├── JSONSelect@0.4.0 ├── escodegen@1.3.3 (estraverse@1.5.1, esutils@1.0.0, source-map@0.1.43) └── cjson@0.3.0 (jsonlint@1.6.0)

$ bin/sparql-to-json queries/artists-ghent.sparql

module.js:340 throw err; ^ Error: Cannot find module './lib/SparqlParser' 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. (~/LDF/SPARQL.js/sparql.js:1:76) 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)


Please consider that the VM used at work was created with vagrant,
installing the nodejs environmente during the provisioning, so the
environment was not already installed there. In case I could send you the
vagrant config, to reproduce that environment.

thank you in advacne for any suggestions.
Alfredo

2016-07-08 19:59 GMT+02:00 Ruben Verborgh <notifications@github.com>:

> Sorry, I can't reproduce. Here are the steps I followed:
>
> git clone https://github.com/RubenVerborgh/SPARQL.js.git
> cd SPARQL.js/
> npm install
> bin/sparql-to-json queries/artists-ghent.sparql
>
> What does npm install give as output? What is your Node.js version?
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <https://github.com/RubenVerborgh/SPARQL.js/issues/30#issuecomment-231429099>,
> or mute the thread
> <https://github.com/notifications/unsubscribe/AAFYfLYCgzXpBgyaY3B5Ga0Wppdlfz8Nks5qTo_zgaJpZM4JH4H7>
> .
>
RubenVerborgh commented 8 years ago

sudo should not be necessary, since npm install just needs access to the node_modules folder inside of SPARQL.js (which you have write access to), so this might already be a sign that something is off.

What is lacking in your npm install output is

> sparqljs@1.1.4 prepublish /private/tmp/SPARQL.js

This is automatically executed with npm install. I don't know if the sudo is to blame, but you can just manually run it with

npm run prepublish
seralf commented 8 years ago

thanks very much Ruben! now it works! :-) On Monday I'll update it on the actual test at work adding the line to my installation scripts, thank you very much.

weird enough btw! the sudo part was for me necessarily on the default installation on nodejs, I will do some research of why, at this point, just to understand the reasons at least (ubuntu machine - VM, latest nodejs)

thank you very much

2016-07-08 20:29 GMT+02:00 Ruben Verborgh notifications@github.com:

sudo should not be necessary, since npm install just needs access to the node_modules folder inside of SPARQL.js, so this might already be a sign the something is off.

What is lacking in your npm install output is

sparqljs@1.1.4 prepublish /private/tmp/SPARQL.js

This is automatically executed with npm install. I don't know if the sudo is to blame, but you can just manually run it with

npm run prepublish

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/RubenVerborgh/SPARQL.js/issues/30#issuecomment-231437189, or mute the thread https://github.com/notifications/unsubscribe/AAFYfKvL_XnqPtpLyJ32uwMNyEsk_bhXks5qTpcZgaJpZM4JH4H7 .

Ka1Wang commented 4 years ago

Hi, I also want to test the SPARQL parser in Ubuntu, and get the same error as following. If I execute npm install, I will get

$ npm install
audited 1239 packages in 2.355s
found 44 low severity vulnerabilities
  run 'npm audit fix' to fix them, or 'npm audit' for details
$ bin/sparql-to-json queries/artists-ghent.sparql
internal/modules/cjs/loader.js:583
    throw err;
    ^

Error: Cannot find module './lib/SparqlParser'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
    at Function.Module._load (internal/modules/cjs/loader.js:507:25)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.<anonymous> (/data/wk/software/tmux-new/SPARQLjs/SPARQL.js-master/sparql.js:1:76)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)

If I execute npm -g install, I will get

$ npm -g install
/data/wk/software/tmux-new/node/node-v10.9.0-linux-x64/bin/sparqljs -> /data/wk/software/tmux-new/node/node-v10.9.0-linux-x64/lib/node_modules/sparqljs/bin/sparql-to-json
+ sparqljs@3.0.1
added 1 package from 1 contributor in 0.503s
$ bin/sparql-to-json queries/artists-ghent.sparql
internal/modules/cjs/loader.js:583
    throw err;
    ^

Error: Cannot find module './lib/SparqlParser'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
    at Function.Module._load (internal/modules/cjs/loader.js:507:25)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.<anonymous> (/data/wk/software/tmux-new/SPARQLjs/SPARQL.js-master/sparql.js:1:76)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)

I would appreciate it if you could help me.

RubenVerborgh commented 4 years ago

@Ka1Wang You need to run npm run build.

Ka1Wang commented 4 years ago

Thanks a lot, Ruben! Now it works!