导入bootstrap in angular 6 angular.json错误:ENOENT:没有这样的文件或目录

Pac*_*los 3 bootstrap-4 angular

在Angular 6中导入引导程序的正确方法是什么.在以前的版本中,我这样做并且它正常工作.

angular-cli.json(Angular 5)

"styles": [
    "styles.scss"
  ],
"scripts": [
    "../node_modules/jquery/dist/jquery.slim.min.js",
    "../node_modules/popper.js/dist/umd/popper.min.js",
    "../node_modules/bootstrap/dist/js/bootstrap.min.js"
  ],
Run Code Online (Sandbox Code Playgroud)

angular.json(Angular 6)

"styles": [
          "src/styles.css"
        ],
"scripts": [
          "../node_modules/jquery/dist/jquery.slim.min.js",
          "../node_modules/popper.js/dist/umd/popper.min.js",
          "../node_modules/bootstrap/dist/js/bootstrap.min.js"
        ]
Run Code Online (Sandbox Code Playgroud)

得到错误:

Error: ENOENT: no such file or directory, open '/Users/pacozevallos/myApp/node_modules/jquery/dist/jquery.slim.min.js'
Run Code Online (Sandbox Code Playgroud)

Cha*_*ran 7

此配置应该有效,因为正如您在angular.json文件中看到的那样,有"root": "",导入文件的属性,因此请按照下面的代码进行操作

"styles": [
   "src/styles.scss",
   "node_modules/bootstrap/dist/css/bootstrap.min.css"
],
"scripts": [
   "node_modules/jquery/dist/jquery.slim.min.js",
   "node_modules/popper.js/dist/umd/popper.min.js",
   "node_modules/bootstrap/dist/js/bootstrap.min.js"
]
Run Code Online (Sandbox Code Playgroud)