How do you prevent install of “devDependencies” NPM modules for Node.js (package.json)?

The npm install command will install the devDependencies along other dependencies when run inside a package directory, in a development environment (the default). In version 8.x and above use –omit=dev flag to install only regular dependencies: npm install –omit=dev This will install only dependencies, and not devDependencies, regardless of the value of the NODE_ENV environment … Read more

Is there a way to get version from package.json in nodejs code?

I found that the following code fragment worked best for me. Since it uses require to load the package.json, it works regardless of the current working directory. var pjson = require(‘./package.json’); console.log(pjson.version); A warning, courtesy of @Pathogen: Doing this with Browserify has security implications. Be careful not to expose your package.json to the client, as … Read more

Why does “npm install” rewrite package-lock.json?

Update 3: As other answers point out as well, the npm ci command got introduced in npm 5.7.0 as additional way to achieve fast and reproducible builds in the CI context. See the documentation and npm blog for further information. Update 2: The issue to update and clarify the documentation is GitHub issue #18103. Update … Read more

xcode-select active developer directory error

This problem happens when xcode-select developer directory was pointing to /Library/Developer/CommandLineTools when a full regular Xcode was required (happens when CommandLineTools are installed after Xcode) Solution: Install Xcode (get it from https://appstore.com/mac/apple/xcode) if you don’t have it yet. Accept the Terms and Conditions. Ensure Xcode app is in the /Applications directory (NOT /Users/{user}/Applications). Point xcode-select … Read more

npm WARN package.json: No repository field

It’s just a check as of NPM v1.2.20, they report this as a warning. However, don’t worry, there are sooooooo many packages which still don’t have the repository field in their package.json. The field is used for informational purposes. In the case you’re a package author, put the repository in your package.json, like this: “repository”: … Read more

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