Tag: npm

Using Shell Commands in JS-Projects or in Scripts in package.json

1. ShellJS

ShellJS is a portable (Windows/Linux/OS X) implementation of Unix shell commands on top of the Node.js API. You can use it to eliminate your shell script’s dependency on Unix while still keeping its familiar and powerful commands. You can also install it globally so you can run it from outside Node projects – say goodbye to those gnarly Bash scripts!

$ npm install [-g] shelljs

2. Shx

shx is a wrapper around ShellJS Unix commands, providing an easy solution for simple Unix-like, cross-platform commands in npm package scripts.

$ npm install shx --save-dev

Difference Between ShellJS and shx

  • ShellJS: Good for writing long scripts, all in JS, running via NodeJS (e.g. node myScript.js).
  • shx: Good for writing one-off commands in npm package scripts (e.g. "clean": "shx rm -rf out/").


Brew node / npm Problem: Error: Cannot find module ‘semver’

  • sudo rm -rf /usr/local/lib/node_modules
  • sudo rm -rf ~/.npm
  • brew uninstall –force node
  • brew install node

Angular Testing Revisited – V4+



ng new ng-testing --routing
npm start
ng test
ng test --code-coverage

Yarn vs NPM

Commons: init, link, outdated, publish, run, cache clean, login, logout, test
npm install
npm install foo --save
yarn add foo
npm uninstall foo --save
yarn remove foo
npm install foo --save-dev
yarn add foo --dev
npm update --save
yarn upgrade
npm install foo@latest --save
yarn add foo
npm install foo --global
yarn add foo global
npm install npm@latest
yarn self-update
npm install --production
yarn --production
Only Yarn
yarn licenses ls
yarn licenses generate-disclaimer
yarn why foo
yarn upgrade-interactive
Only NPM
npm xmas
npm visnup

Copyright © 2020 EBIA

Theme by Anders NorenUp ↑