Ionic project zip download, opened in Visual Studio Code, get 'angular is not defined', Why?


Works fine when opening the same in Webstorm, how to resolve the complaint in Visual Studio Code
Check list: 1. using terminal cd to folder, 2. run code . (opens Visual Studio Code in folder) 3. ^` opens VSC terminal, run ‘npm install angular’ (see ‘nodes_module’ folder with js/angular library installed) 4. click debug to run project, click add launch.json, select ‘nodejs’ environment and edit path to ‘app.js’ 5. open ‘index.html’ and include ‘<script src=…’ tag for referencing angular library inside node_module placing that script tag just above the script tag for ‘app.js’. 6. try running project, debug finds ‘app.js’ and stops on first line ‘angular.module…’: error is ‘angular is undefined’. Any thoughts? Same project, right after the unzip, runs fine in Webstorm! Thanks in advance!!!


Have you tried the Cordova Tools Extension for VS Code? I’d suggest using it to debug a Cordova application and it will provide you with a Cordova-specific configuration for launch.json that should take care of this.

I think the error you’re getting is caused by debugging the app as a Node.JS application, which won’t load the HTML & other files you use in an Ionic/Cordova project.