I am trying to start project with using Docker Compose at Ubuntu (16.04 LTS). However, I have this issue with 'passport' module
api_1 | [nodemon] 1.11.0
api_1 | [nodemon] to restart at any time, enter `rs`
api_1 | [nodemon] watching: *.*
api_1 | [nodemon] starting `node --debug server.js`
api_1 | Debugger listening on 127.0.0.1:5858
api_1 | module.js:472
api_1 | throw err;
api_1 | ^
api_1 |
api_1 | Error: Cannot find module 'passport'
api_1 | at Function.Module._resolveFilename (module.js:470:15)
api_1 | at Function.Module._load (module.js:418:25)
api_1 | at Module.require (module.js:498:17)
api_1 | at require (internal/module.js:20:19)
api_1 | at Object.<anonymous> (/app/auth.js:4:16)
api_1 | at Module._compile (module.js:571:32)
api_1 | at Object.Module._extensions..js (module.js:580:10)
api_1 | at Module.load (module.js:488:32)
api_1 | at tryModuleLoad (module.js:447:12)
api_1 | at Function.Module._load (module.js:439:3)
api_1 | at Module.require (module.js:498:17)
api_1 | at require (internal/module.js:20:19)
api_1 | at Object.<anonymous> (/app/server.js:3:14)
api_1 | at Module._compile (module.js:571:32)
api_1 | at Object.Module._extensions..js (module.js:580:10)
api_1 | at Module.load (module.js:488:32)
api_1 | [nodemon] app crashed - waiting for file changes
before starting...
The main thing is that:
1) Docker is running everything (and sets everything up, as mentioned in Dockerfile)
2) There is passport dependency in package.json, in /app (where the server is launched).
3) Passport as well as Node with npm are globally installed in Ubuntu (even though, Docker must set up all of these itself).
4) I have const passport = require('passport');
in the files where it is used.
Thus, I suspect that there are problems with some folder or file permissions (maybe even Docker's). How can I solve this problem?
Update:
I just had to completely reinstall the docker and docker-compose and everything worked perfect.
Update: Another (probably, main) reason was that my Internet provider was blocking NPM, this is why I could not download (somehow) some of the packages. Thus, it worked out when I connected to another WiFi network.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.