Category Archives: NPM

TypeError: Cannot read property ‘thisCompilation’ of undefined

Follow these steps one by one  to resolve the error

npm i -g @angular/cli@latest
rm -rf node_modules / rd /s /q node_modules
npm cache clear --force
npm cache verify
npm install
npm uninstall webpack
npm install --save-dev --save-exact @angular/cli@latest

You might get below error also 

webpack/lib/node/NodeTemplatePlugin'


Solution 
npm remove webpack -g

npm i webpack --save-dev

109 total views, no views today

Angular 2 with NPM hello world

Step 1 : Installing Nodejs
To access to the Node Package Manager (NPM) and run our server, we need to first install Nodejs.
You may already have it installed. To check whether it’s installed, visit your console and type:
node -v
If it goes unrecognized, you will need to visit Nodejs.organd visit the downloads page. Choose the installer appropriate for your OS, and install it.

Once complete, reload your console/command line, and re-run the
This time it should provide you with the version installed.
Step 2: Installing Angular

We’re going to use the Angular CLI to create our Angular app. Let’s install it at the command line through NPM.
npm install @angular/cli -g
  
Give it some time to install once installed go into the any folder where you prefer to store your projects and then run the following command:
ng new mean
cd mean
Once you’re in the new project folder, we’re going to run a command with the Angular CLI that will create a build of our project. We need to do this because our server is going to look for a /dist folder to serve the files. Run below command to build your project.
ng build
Now Run the Angular 2 application by typing below command.
ng serve
Now, open the browser then go to 
http://localhost:4200
you should see angular page.

Close the running Angular app first by press ctrl+c

90 total views, no views today