npm install package from github repo subfolder

Add to package.json: … “scripts”: { “postinstall”: “mkdir BotBuilder; cd BotBuilder; git init; git remote add -f origin https://github.com/Microsoft/BotBuilder.git; git config core.sparseCheckout true; echo \”Node/core\” >> .git/info/sparse-checkout; git pull –depth=1 origin master; cd ..; npm i ./BotBuilder/Node/core/” … }, … postinstall script is running after the package is installed. And step by step: Make folder … Read more

How do I decide whether @types/* goes into `dependencies` or `devDependencies`?

Let’s say you’re developing a package “A” that have @types/some-module package in devDependencies. For some reason you’re exporting the type from @types/some-module: import { SomeType } from ‘some-module’; export default class APackageClass { constructor(private config: SomeType) { // … } } Right now TypeScript consumers of package “A” are unable to guess what SomeType is, … 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

Cannot install bcrypt node.js module on Centos Server

There is also a native-js version of bcrypt which does not require compiling. https://github.com/shaneGirish/bcrypt-nodejs npm install bcrypt-nodejs The api is very similar to the compiled version. The following is taken directly from the readme Basic usage: Synchronous var hash = bcrypt.hashSync(“bacon”); bcrypt.compareSync(“bacon”, hash); // true bcrypt.compareSync(“veggies”, hash); // false Asynchronous bcrypt.hash(“bacon”, null, null, function(err, hash) … Read more

npm install -g karma error MSB4019: The imported project “C:\Microsoft.Cpp.Default.props” was not found

For those that still run into errors after installing a VS with Windows SDK and trying Besrl’s solution, in particular node-gyp failing with Error MSB4019: The imported project “X:\Microsoft.Cpp.Default.props” was not found, Try running the npm install commands from a MSVS command prompt. Find it at Start menu > Microsoft Visual Studio 201X > Visual … Read more

Running Mocha 6 ES6 tests with Babel 7, how to set up?

Testing in ES6 with Mocha and Babel 7. Look here: https://dev.to/bnorbertjs/my-nodejs-setup-mocha–chai-babel7-es6-43ei or http://jamesknelson.com/testing-in-es6-with-mocha-and-babel-6/ npm install –save @babel/runtime npm install –save-dev @babel/plugin-transform-runtime And, in .babelrc, add: { “presets”: [“@babel/preset-env”], “plugins”: [ [“@babel/transform-runtime”] ] }

NPM – Can’t install socket.IO

At least one of the packages in Socket.IO’s dependency tree is a C/C++ addons which needs to be compiled on your system as it’s installed. And, since it’s a dependency, if it doesn’t succeed in installing, neither will Socket.IO. To enable cross-system compilation, Node.js uses node-gyp as its build system. You’ll need to have it … Read more