Jquery not working in angular 6 Error: ENOENT: no such file or directory, open '…\node_modules\jquery\dist\jquery.min.js'

前端 未结 11 1694
离开以前
离开以前 2021-02-01 02:02

I am in process migrating Angular 5 project to Angular 6.

While starting application by

npm start

getting the below error



        
11条回答
  •  执笔经年
    2021-02-01 02:29

    Install @ngBootstrap with this npm install --save @ng-bootstrap/ng-bootstrap and npm install jquery --save or npm install @types/jquery --save after the installation go to angular.json and locate where

    "styles": [
                  {
                    "input": "styles.css"
                  }
                ],
                "scripts": []
    

    and change it to this :

    "styles": [
        "styles.css",
        "./node_modules/bootstrap/dist/css/bootstrap.min.css"
      ],
      "scripts": [
        "./node_modules/jquery/dist/jquery.min.js",
        "./node_modules/bootstrap/dist/js/bootstrap.min.js"
      ]
    

    and ng server --open to run your project

提交回复
热议问题