I'm getting into trouble with anngular-cli installation because it doesn't recognize the ng command in my git bash but it works in my cmd on Windows 7.
I looked for some issues on the web but I didn't really find a solution.
Here, the error :
ng -v module.js:549 throw err; ^ Error: Cannot find module 'C:\Program Files\Git\node_modules\@angular\cli\bin\ng' at Function.Module._resolveFilename (module.js:547:15) at Function.Module._load (module.js:474:25) at Function.Module.runMain (module.js:693:10) at startup (bootstrap_node.js:191:16) at bootstrap_node.js:612:3
This error happened the first time I used ng after installing Node and angular-cli globally.
I didn't get this error when I was working on my laptop on Windows 10.
To solve the error "Cannot find module '@angular/core'", make sure you have installed all dependencies by running the npm install command, set the baseUrl option to src in your tsconfig. json file and restart your IDE and development server. Copied!
If you are getting the "Cannot find module" error when trying to run a local file, make sure that the path you passed to the node command points to a file that exists. For example, if you run node src/index. js , make sure that the path src/index. js points to an existing file.
To solve the error "Could not find module '@angular-devkit/build-angular'", make sure to install the package by opening your terminal in your project's root directory and running the following command: npm i -D @angular-devkit/build-angular and restart your IDE and development server.
To solve the error "ng: command not found", install the angular cli package globally by running npm install -g @angular/cli@latest and restart your terminal. If the command fails, run it with sudo and make sure the correct PATH is set in your system's environment variable.
Problem:
Error: Cannot find module '..\AppData\Roaming\npm\node_modules\angular-cli\bin\ng' angularJs
Solution:
uninstall angular cli if you have already installed it
npm uninstall -g @angular/cli
Delete the C:\Users\Satish\AppData\Roaming\npm\node_modules@angular folder if it still exists after the uninstall
reinstall angular-cli globally
npm install -g @angular/cli
It worked for me only by removing npm and npm-cache folders from AppData then running :
npm uninstall -g @angular/cli
Then running :
npm install -g @angular/cli
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