Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NPM - Error: Cannot find module '../'

I'm reading this doc on hapi-auth-cookie and trying to run sample server.here is what i did :

1-putting sample server in server.js

2-npm init

3-node server.js

4-npm install --save hapi

5-node server.js but this time i get a new error

Error: Cannot find module '../'

somewhere in the code it's requiring '../'

server.register(require('../'), (err) => {

    if (err) {
        throw err;
    }

But i don't understand this part really.you can see the full code in the link above.what should i do? thanks

like image 612
Mojtaba Avatar asked Jul 21 '26 02:07

Mojtaba


2 Answers

I had the same error. I just deleted the node_modules directory and rerun install.

rm -rf node_modules/
npm install

After that the app runs correct again.

like image 76
jzilg Avatar answered Jul 24 '26 17:07

jzilg


Maybe there isn't a index.js file in directory ../.

like image 34
AuThor Avatar answered Jul 24 '26 17:07

AuThor



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!