I have installed the magento2 successfully but there are a lot of js error

try following :

  1. make bin/magento executable

    chmod +x bin/magento
    
  2. Clear cache etc in var folder

    rm -rf var/cache/ var/di/ var/generation/ var/page_cache/
    
  3. Run Setup ( if any thing missing )

    bin/magento setup:upgrade
    
  4. Deploy Static Content

    bin/magento setup:static-content:deploy
    
  5. Give Permission to var & pub folders

    chmod -R 777 pub/ var/
    

now all the static files containing js, css etc will be deployed in pub/static folder


Remove all files and folder in pub/static except .htaccess and then run:

php bin/magento setup:static-content:deploy

Problem solved ...

There is a 'cache' system for these static resources. navigate to the folder dev/tools/Magento/Tools/View

Run the below command in the terminal

php deploy.php

After running this command css and other files created under the Pub/static/ folder and all the css will appear and page look fine.