I have full-stack application with express and default vue-webpack-boilerplate. My project structure looks like this:
├── client
│ ├── build
│ │ └── ...
│ ├── config
│ │ └── ...
│ ├── dist
| | └── ...
│ ├── index.html
│ ├── src
│ │ ├── App.vue
│ │ ├── assets
│ │ │ └── ...
│ │ ├── components
│ │ │ └── ...
│ │ ├── main.js
│ │ └── router
│ └── static
├── node_modules
├── package.json
└── server
├── app.js
├── bin
│ └── www
└── routes
└── ...
When I run $ node client/build/dev-server.js
i receive this error:
ERROR Failed to compile with 2 errors
These relative modules were not found:
* ./build/dev-client in multi ./build/dev-client ./src/main.js
* ./src/main.js in multi ./build/dev-client ./src/main.js
but only if I trying to run it from client folder it works properly.
$ cd client
$ node build/dev-server.js
any suggestions?
This is the error with relative paths. You need to change all paths exept those with used in require()
, relative to the new root folder, not the client folder. Good practice is using of __dirname
which is same to path.diranme()
method. Check this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With