npm install: Is there a way to ignore a particular dependency in package.json

That can be done using devDependencies The npm modules which you require only to develop, e.g.: unit tests, Coffeescript to Javascript transpilation, minification etc,make the required module a devDependency. To skip Installation of devDepenencies pass –production flag to npm install,with the –production flag(or NODE_ENV environment variable set to production) npm will not install modules listed … Read more

ts-node execute typescript with module import and module defined

The Error Warning: To load an ES module, set “type”: “module” in the package.json or is caused by the following Bug in ts-node: https://github.com/TypeStrong/ts-node/issues/935 The Bug is closed, and there is a proposal to solve it, but it is still open: https://github.com/TypeStrong/ts-node/issues/1007 I don’t need “type”: “module” in package.json. In tsconfig.json, I’m using using “module”: … Read more

Yarn – Node Sass does not yet support my current environment

I’m using OSX latest version(10.14.4 (18E226)) and node 12. While using node-sass 4.11, I had g++ error(../src/create_string.cpp:17:25: error: no matching constructor for initialization of ‘v8::String::Utf8Value’) while trying npm install, npm rebuild(link) which did not work. I solved this by updating node-sass to 4.12(npm install node-sass), as the github issue on the node-sass says that support … Read more

How to list all the commands available in package.json?

You can use: npm run to list all commands. (Yarn also features similar functionality on yarn run.) This behavior is made explicit in the help page of npm help run: This runs an arbitrary command from a package’s “scripts” object. If no “command” is provided, it will list the available scripts. To get a quick … Read more

Is there a way to specify angular version with the ng new command

It can be done by using npx command that downloads and runs the package without installing it. For example, npx @angular/cli@9 new my-project creates a new folder my-project in the current folder and puts a new project here using angular version 9. The local version of @angular/cli in this case will be the same as … Read more

How can I display the current app version from package.json to the user using Vite?

For React & TypeScript users: Add a define to your vite.config.ts: import react from ‘@vitejs/plugin-react’; import { defineConfig } from ‘vite’; export default defineConfig({ plugins: [react()], define: { APP_VERSION: JSON.stringify(process.env.npm_package_version), }, }); If you haven’t got one already, define a vite-env.d.ts or env.d.ts and add a declare: declare const APP_VERSION: string; You’ll now be able … Read more

how to execute powershell ps1 scripts from package.json “scripts”?

Assuming powershell is in you PATH you can call it like this: “scripts”: { “test”: “@powershell -NoProfile -ExecutionPolicy Unrestricted -Command ./test.ps1” } Tested on Windows 7 with Powershell v4. Limitations are that you need Powershell installed and in your PATH. I didn’t test it with Powershell for Linux, so not sure if this solution will … Read more

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