Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npm start fails #1

Closed
spaceone opened this issue Aug 29, 2019 · 2 comments
Closed

npm start fails #1

spaceone opened this issue Aug 29, 2019 · 2 comments

Comments

@spaceone
Copy link

Hello tihawk,

I am unable to install/start this application:
First, a dependency was missing, I had to do:

$ npm install nodemon

After that, I run into troubles:

$ npmstart
> test_task@1.0.0 start /Downloads/register-user
> nodemon index.js

[nodemon] 1.19.1
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `node index.js`
module.js:550
    throw err;
    ^

Error: Cannot find module '/Downloads/register-user/node_modules/sqlite3/lib/binding/node-v57-linux-x64/node_sqlite3.node'
    at Function.Module._resolveFilename (module.js:548:15)
    at Function.Module._load (module.js:475:25)
    at Module.require (module.js:597:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/Downloads/register-user/node_modules/sqlite3/lib/sqlite3.js:4:15)
    at Module._compile (module.js:653:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
[nodemon] app crashed - waiting for file changes before starting...
$ nodejs --version
v8.16.0

I also tried with an older version of nodejs, which causes:

# npm start                                                                                                                                                                                                                                        

> test_task@1.0.0 start /root/register-user
> nodemon index.js

[nodemon] 1.19.1
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `node index.js`
/root/register-user/index.js:8
let exists = fs.existsSync(dbFile);
^^^

SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:373:25)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Function.Module.runMain (module.js:441:10)
    at startup (node.js:140:18)
    at node.js:1043:3
[nodemon] app crashed - waiting for file changes before starting...
@tihawk
Copy link
Owner

tihawk commented Aug 29, 2019

This issue seems to be related to the node version (I used ^10.). More precisely, it seems to be connected to node-pre-gyp : ref: node_sqlite3.node #906.

If using node v8.16.0 I suggest running npm rebuild. This worked for me:

$ npm rebuild

> sqlite3@4.1.0 install [...]/node_modules/sqlite3
> node-pre-gyp install --fallback-to-build

...
$ npm start

> test_task@1.0.0 start [...]/test-task
> nodemon index.js

[nodemon] 1.19.1
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `node index.js`
body-parser deprecated undefined extended: provide extended option index.js:15:17
Created new table Users
Server: Listening on port 3000
$ node --version
v8.16.0

I also added 'use strict';, which should resolve the older node version problem.

@spaceone
Copy link
Author

Thank you, with another dependency and npm rebuild it works!

$ npm install node-pre-gyp
$ npm rebuild

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants