ais-one/cookbook

example spa: relative modules were not found

Closed this issue · 8 comments

Tried to follow the quick start section of README.md. Step npm start exitted with:

...
[1] <s> [webpack.Progress] 94% after seal
[1] <s> [webpack.Progress] 95% emitting
[1] <s> [webpack.Progress] 95% emitting HtmlWebpackPlugin
[1] <s> [webpack.Progress] 95% emitting CopyPlugin
[1] <s> [webpack.Progress] 98% after emitting
[1] <s> [webpack.Progress] 98% after emitting CopyPlugin
[1]  ERROR  Failed to compile with 2 errors18:06:26
[1] 
[1] These relative modules were not found:
[1] 
[1] * ../../cfg.json in ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/vuetify-loader/lib/loader.js!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/pages/SignIn.vue?vue&type=script&lang=js&
[1] * ../cfg.json in ./src/firebase.js
[1] <s> [webpack.Progress] 100% 
[1] 

... and the top of the build log says:

$ npm start

> example-spa@0.0.0 start /home/dmoebius/src/vue-crud-x/example-spa
> concurrently "npm run rest" "npm run serve"

[0] 
[0] > example-spa@0.0.0 rest /home/dmoebius/src/vue-crud-x/example-spa
[0] > cd ../backend&&npm run-script dev
[0] 
[1] 
[1] > example-spa@0.0.0 serve /home/dmoebius/src/vue-crud-x/example-spa
[1] > vue-cli-service serve --port 8080
[1] 
[0] 
[0] > functions@ dev /home/dmoebius/src/vue-crud-x/backend
[0] > set NODE_ENV=development&&nodemon index.js
[0] 
[1]  INFO  Starting development server...
[0] [nodemon] 1.19.1
[0] [nodemon] to restart at any time, enter `rs`
[0] [nodemon] watching: *.*
[0] [nodemon] starting `node index.js`
[0] Environment:  undefined
[0] HTTPS:  No
[0] env development
[0] KEYV_CACHE undefined
[0] use map
[0] internal/modules/cjs/loader.js:583
[0]     throw err;
[0]     ^
[0] 
[0] Error: Cannot find module '../models/User'
[0]     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
[0]     at Function.Module._load (internal/modules/cjs/loader.js:507:25)
[0]     at Module.require (internal/modules/cjs/loader.js:637:17)
[0]     at require (internal/modules/cjs/helpers.js:22:18)
[0]     at Object.<anonymous> (/home/dmoebius/src/vue-crud-x/backend/services/index.js:9:14)
[0]     at Module._compile (internal/modules/cjs/loader.js:689:30)
[0]     at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
[0]     at Module.load (internal/modules/cjs/loader.js:599:32)
[0]     at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
[0]     at Function.Module._load (internal/modules/cjs/loader.js:530:3)
[0]     at Module.require (internal/modules/cjs/loader.js:637:17)
[0]     at require (internal/modules/cjs/helpers.js:22:18)
[0]     at Object.<anonymous> (/home/dmoebius/src/vue-crud-x/backend/middleware/auth.js:1:100)
[0]     at Module._compile (internal/modules/cjs/loader.js:689:30)
[0]     at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
[0]     at Module.load (internal/modules/cjs/loader.js:599:32)
[0] [nodemon] app crashed - waiting for file changes before starting...
[1] <s> [webpack.Progress] 0% compiling
[1] <s> [webpack.Progress] 10% building 0/0 modules 0 active 
...

I see. cp example-app/cfg.sample.json example-app/cfg.json helped a bit, but I need to fill in projectId and apiKey, or else I will get "projectId must be a string in FirebaseApp.options" or "Your API key is invalid, please check you have copied it correctly." Seems that example-spa cannot run without firebase db, or can it?

Hi,

Your problem has got to do with the backend folder...

models/User cannot be found because the file in user.js instead of User.js in my repo.

I am developing on windows and casing may have caused a problem...

You can rename the file from user.js to User.js to get it working...

I will fix it in next release, sometime early next month...

Ok, renaming user.js to User.js helped removing the first error. But the demo cannot run without a proper cfg.json with valid projectId and apiKey, can it?

Hi...

You are right, let me work on a fix... If you need to get it working quick...

Search for all @/firebase, comment it out...

And comment out anything using the firebase stuff...

You may need to remove those with @/mongo also...

Will add in environment variables to enable or disable mongo, firebase, target to finish by end of the week.

I pushed to develop branch... I have made fixes...

You can use the cfg.json file in there (with empty keys), I will make further improvement on this.

Fixed

#73