Home > OS >  Where to install DataTables in slim4 by Daniel Opitz
Where to install DataTables in slim4 by Daniel Opitz

Time:01-28

I purchased the eBooks by Daniel Opitz. I am on page 226 of the books because I want to implement data tables in my project. In the books it reads.

DataTables Setup
DataTables.net is a very flexible table plug-in for jQuery.
You have to setup jQuery for Webpack first.
To install the DataTables Core library, run:
npm install datatables.net
npm install datatables.net-dt
To install the DataTables Bootstrap 5 styles, run:
npm install datatables.net-bs5
npm install datatables.net-responsive-bs5
npm install datatables.net-select-bs5
Add a new webpack entry in webpack.config.js:

In my naivete, I can't figure out on my own where I should be running the npm install. I was hoping this would be the fastest route to get help.

I have enjoyed learning the skeleton that he published. Most things have been straight forward and not to hard to figure out. This one has me stumped.

I did some more searching looking for the package.json location.

https://odan.github.io/slim4-skeleton/frontend.html https://odan.github.io/slim4-skeleton/directory-structure.html

I looked over the directory structure and still not obvious to me where the npm should be executed.

CodePudding user response:

Most package managers work by using a configuration file found in the root directory for the tooling you're trying to use. Generally, the assumption is these go in the root of the project. For instance:

/composer.json         # PHP's Composer
/package.json          # Javascript's NPM
/requirements.txt      # Python's PIP

These are typically created by the package manager:

composer init
npm init
pip freeze > requirements.txt

Here are a some articles that can help explain this process:

I'll also note many package managers will use a lock file, which records what was the last resolved and installed packages. The files above, in other words, depict what should be, while the lock file depicts what was (last) installed.

Your lock file should be handled with care and committed to the your project's repo. When you remove it, you are telling that package manager to recalculate the installed packages list and you may have subtly different versions (leading to potential bugs).

/composer.lock
/package-lock.json
  • Related