Rookie question: whether axios is installed in devDependencies or dependencies

just didn"t pay attention to this problem before. The official installation of axios on github is:

$ npm install axios

that is tantamount to installing in dependencies, but my current project is installed in devDependencies, and the key is that it can still be used normally after packaging, so I don"t understand

.
Mar.28,2021

except for the difference in literal meaning,

The difference between

dependencies and devDependencies also lies in:

if your project is a package published to npm ,
then the dependency in dependencies in the package package.json will be downloaded to the package's node_modules folder (if your project itself does not have this dependency), while devDependencies will not.

for example:
I have released a component A , which has dependencies:lodash and devDependencies:moment .
so, if your project npm install has components A .
unless your project also relies on lodash and has the same version, then under node_modules/A there will be a node_modules with lodash in it.
and moment will not appear in your project anyway.

as for general projects, no matter whether you are installed in dev or dependencies, they will be installed during installation and will be typed in when they are packaged. The only way to distinguish dependencies is to make the project look clearer.


because npm I installs all dependencies, add -P or -D to specify installation production or development dependencies.

of course, axios must be dependent on production


dependencies and devDependencies are both dependencies on this project.

dependences is the dependency that the project needs to run properly, while devDependencies is the dependency that developers need for the entire project when developing (for example, there will be some test dependencies and so on).

npm install-- save * / / will be downloaded to the node_modules directory, package.json dependencies will be modified,
npm install-- save-dev * * / will be downloaded to the node_modules directory, package.json will be modified, and devDependencies will add
npm install * * / / to the node_modules directory. Package.json
npm install / / two dependencies will be installed by default
npm install * -- save / / will be downloaded to the node_modules directory, and package.json dependencies will be modified to increase

.

just look at the name.. One is development dependence and the other is production dependence. You said that the package can still be used, you can look at the source file after build, can you find the corresponding source code


when packaging, as long as it is introduced, and if no other configuration is made, it will be packaged. If axios is introduced, it will be packaged. Of course, you can use

normally. For more information, please take a look at the npm- development and production environment

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3dde6-2c3d0.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3dde6-2c3d0.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?