Error: Cannot find module '/var/www/angular2restfulservice/server.js
Closed this issue · 1 comments
Hi,
I watched your great course Play by Play: Docker for Web Developers with John Papa and Dan Wahlin
(thank you very much for that), but when I try to run docker-compose on my machine i receive Error
Error: Cannot find module '/var/www/angular2restfulservice/server.js'
I run on Windows 10 and docker version Docker version 1.12.1, build 23cf638
.
When I run docker-compose build
I receive
D:\Projekty\AngularJs\2.0\Angular2-RESTfulService>docker-compose build
Building node
Step 1 : FROM node:latest
---> f4e366168fa6
Step 2 : MAINTAINER Dan Wahlin
---> Using cache
---> a1bf869433e1
Step 3 : ENV CONTAINER_PATH /var/www/angular2restfulservice
---> Using cache
---> 1e7e0e827ce7
Step 4 : WORKDIR $CONTAINER_PATH
---> Using cache
---> bcf8205100a6
Step 5 : RUN npm install supervisor -g
---> Using cache
---> 77dfb9ab1e02
Step 6 : EXPOSE 3000
---> Using cache
---> 59d97e39063c
Step 7 : ENTRYPOINT supervisor server.js
---> Using cache
---> 4738f4d91ab0
Successfully built 4738f4d91ab0
mongodb uses an image, skipping
so it seams that everything is ok, but when I run docker-compose up
I got this
D:\Projekty\AngularJs\2.0\Angular2-RESTfulService>docker-compose up
Creating mongodb
Creating nodeapp
Attaching to nodeapp, mongodb
�[33mmongodb |�[0m 2016-09-23T22:08:23.799+0000 I CONTROL [initandlisten] MongoDB starting : pid=1 port=27017 dbpath=/data/db 64-bit host=4a53d36eb356
�[33mmongodb |�[0m 2016-09-23T22:08:23.799+0000 I CONTROL [initandlisten] db version v3.2.9
�[33mmongodb |�[0m 2016-09-23T22:08:23.799+0000 I CONTROL [initandlisten] git version: 22ec9e93b40c85fc7cae7d56e7d6a02fd811088c
�[33mmongodb |�[0m 2016-09-23T22:08:23.799+0000 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.1t 3 May 2016
�[33mmongodb |�[0m 2016-09-23T22:08:23.799+0000 I CONTROL [initandlisten] allocator: tcmalloc
�[33mmongodb |�[0m 2016-09-23T22:08:23.799+0000 I CONTROL [initandlisten] modules: none
�[33mmongodb |�[0m 2016-09-23T22:08:23.799+0000 I CONTROL [initandlisten] build environment:
�[33mmongodb |�[0m 2016-09-23T22:08:23.799+0000 I CONTROL [initandlisten] distmod: debian81
�[33mmongodb |�[0m 2016-09-23T22:08:23.799+0000 I CONTROL [initandlisten] distarch: x86_64
�[33mmongodb |�[0m 2016-09-23T22:08:23.799+0000 I CONTROL [initandlisten] target_arch: x86_64
�[33mmongodb |�[0m 2016-09-23T22:08:23.799+0000 I CONTROL [initandlisten] options: {}
�[33mmongodb |�[0m 2016-09-23T22:08:23.803+0000 I STORAGE [initandlisten] wiredtiger_open config: create,cache_size=1G,session_max=20000,eviction=(threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),checkpoint=(wait=60,log_size=2GB),statistics_log=(wait=0),
�[36mnodeapp |�[0m
�[36mnodeapp |�[0m Running node-supervisor with
�[36mnodeapp |�[0m program 'server.js'
�[36mnodeapp |�[0m --watch '.'
�[36mnodeapp |�[0m --extensions 'node,js'
�[36mnodeapp |�[0m --exec 'node'
�[36mnodeapp |�[0m
�[36mnodeapp |�[0m Starting child process with 'node server.js'
�[36mnodeapp |�[0m Watching directory '/var/www/angular2restfulservice' for changes.
�[36mnodeapp |�[0m Press rs for restarting the process.
�[33mmongodb |�[0m 2016-09-23T22:08:23.906+0000 I FTDC [initandlisten] Initializing full-time diagnostic data capture with directory '/data/db/diagnostic.data'
�[33mmongodb |�[0m 2016-09-23T22:08:23.907+0000 I NETWORK [HostnameCanonicalizationWorker] Starting hostname canonicalization worker
�[36mnodeapp |�[0m module.js:457
�[36mnodeapp |�[0m throw err;
�[36mnodeapp |�[0m ^
�[36mnodeapp |�[0m
�[36mnodeapp |�[0m Error: Cannot find module '/var/www/angular2restfulservice/server.js'
I do not understated why project code is not available in /var/www/angular2restfulservice/server.js
folder. Thank you for your help in fixing this.
Make sure you're running it from a folder inside of your "Users" folder. Docker has default security restrictions that limit it to that folder. Try it from your desktop as an example just to see if you can get it going.