What is the correct way of adding `react` as a dependency in the `package.json` of a reusable components library?

For reusable components: Put a react dependency in both peerDependencies and devDependencies. Never put a react dependency in dependencies. peerDependencies specifies which version(s) of React your reusable component supports/requires. When using npm 2 this also adds React to the list of modules to be installed, but this is no longer the case with npm 3. … Read more

is there a yarn alternative for npm audit?

Yarn doesn’t have npm audit fix. But here’s how to do it by using npm – temporarily. Generate a package-lock.json file without installing node modules npm i –package-lock-only Fix the packages and update the package-lock.json file npm audit fix Delete the yarn.lock file and convert package-lock.json file into yarn.lock rm yarn.lock yarn import Delete the … Read more

What’s the difference between dependencies, devDependencies, and peerDependencies in NPM package.json file?

Summary of important behavior differences: dependencies are installed on both: npm install from a directory that contains package.json npm install $package on any other directory devDependencies are: also installed on npm install on a directory that contains package.json, unless you pass the –production flag (go upvote Gayan Charith’s answer), or if the NODE_ENV=production environment variable … Read more

How can I exclude dependencies brought in from other sub-projects?

exclude for dependencies has a little bit another syntax, so try to do it providing the module name, which is equals to the exclude-me-project name, like: compile(project(“:commons:some-other-project”)) { exclude module: “exclude-me-project” } Alternatively, you may exclude all the transitive dependencies for commons project, but it will remove all the deps of the some-other-project project, including … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)