Hi,
I am trying to install Vue dependencies globally on my machine instead of relying on a local setup. My goal is to manually install only the necessary modules globally. However, I am struggling to resolve the error: "Cannot find module 'vue-template-compiler'", even though I have installed it.
I have come across solutions suggesting that both vue and vue-template-compiler must have matching versions, which I have ensured in my local setup. This approach works perfectly in my local environment, but when I attempt the same in a global setup, the error persists.
Here is what I mean by local setup and global setup:
Local setup: Installing all dependencies specific to a project within its directory using npm install in /workspaces/node_modules
.
Global setup: Installing only essential dependencies globally on the machine using npm install -g, to avoid tying the dependencies to a single project directory in /usr/local/lib/node_modules/
.
In my local setup, the following modules are installed:
/workspaces
├── @babel/[email protected]
├── @babel/[email protected]
├── @vue/[email protected]
├── @vue/[email protected]
├── @vue/[email protected]
├── @vue/[email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]
In my global setup, I have installed only the following modules:
/usr/local/lib
├── @vue/[email protected] extraneous
├── @vue/[email protected] extraneous
├── [email protected] extraneous
├── [email protected] extraneous
└── [email protected] extraneous
I am relatively new to application development and want to install only the essential dependencies globally to set up the frontend. My plan is to package these dependencies for deployment on another machine, which cannot use the standard method of running npm install -g. While I can install and package the dependencies in the project locally, I am keen to understand why this global approach is not working.