package.json

How to install only “devDependencies” using npm

和自甴很熟 提交于 2019-12-02 17:22:40
I am trying to install ONLY the "devDependencies" listed in my package.json file. But none of the following commands work as I expect. All of the following commands install the production dependencies also which I do not want. npm install --dev npm install --only=dev npm install --only-dev I cannot think of any more ways of telling the npm to install the devDependencies alone. :( Ahmed farag mostafa Check the NPM docs for install : With the --production flag (or when the NODE_ENV environment variable is set to production), npm will not install modules listed in devDependencies . The --only=

How to use Windows console 'set' variables with NPM scripts?

…衆ロ難τιáo~ 提交于 2019-12-02 14:13:31
问题 This works in Windows console as expected: set A="qwerty" && echo %A% the output: "qwerty" But when I try to run the same commands in NPM scipts: package.json: "scripts": { "qwerty": "set A=\"qwerty\" && echo %A%" } > npm run qwerty the output is: %A% Am I doing something wrong or it just shouldn't work that way when run by NPM? 回答1: Your example set A="qwerty" && echo %A% isn't correct. Variables in the cmd prompt / a batch file are expanded once per line / command: ==> set "A=" ==> echo %A%

How to reduce Electron package size that exceeds more than 600 mb

点点圈 提交于 2019-12-02 09:50:33
I see this is because of node-modules and application is packaged with some unwanted stuffs for running. Current file size is 600 mb but I want it to be less than 200 mb. I suspect --no-prune populates all the node-modules in package that is built, but I need only specifies node-modules in the package that is built I tried removing unwanted packages in package.json, it doesn't help me either after refactoring "bundledDependencies": [ "fs", "os", "path", "regedit", "request", "start", "xml2js", "util", "replace", "process", "fs", "console" ], **before refactoring** "bundledDependencies": [

Pass argument from script to gulp task

独自空忆成欢 提交于 2019-12-02 04:06:34
I have package.json scripts with the following structure: "scripts": { "watch:build": "tsc --watch", "watch:server": "nodemon ./src/app.js --watch 'app'", "build": "tsc && gulp do_something", "start": "npm-run-all clean build --parallel watch:build", "watch:server --print-label" } I would like to start the application as npm run start with_argument and pass it to build script, to perform actions in the gulp task based on that argument. I read a lot of tutorial and how to articles, but without result. It is possible somehow to pass argument from one script to another(which starts a gulp task).

How to use Windows console 'set' variables with NPM scripts?

自作多情 提交于 2019-12-02 03:13:38
This works in Windows console as expected: set A="qwerty" && echo %A% the output: "qwerty" But when I try to run the same commands in NPM scipts: package.json: "scripts": { "qwerty": "set A=\"qwerty\" && echo %A%" } > npm run qwerty the output is: %A% Am I doing something wrong or it just shouldn't work that way when run by NPM? Your example set A="qwerty" && echo %A% isn't correct. Variables in the cmd prompt / a batch file are expanded once per line / command: ==> set "A=" ==> echo %A% %A% ==> set A="qwerty" && echo %A% %A% ==> echo %A% "qwerty" Why this behaviour? The SET command was first

Bootstrap suddenly not working for my React JS project

你离开我真会死。 提交于 2019-12-02 01:44:20
问题 Out of the blue bootstrap has stopped working on my project. I have no idea why. Here is our package.json: { "name": "blankets", "version": "0.1.0", "private": true, "dependencies": { "amazon-cognito-identity-js": "^1.26.0", "aws-sdk": "^2.151.0", "bootstrap": "^4.0.0", "jwt-decode": "^2.2.0", "prop-types": "^15.6.0", "react": "^16.1.1", "react-bootstrap": "^0.31.5", "react-dom": "^16.1.1", "react-router-dom": "^4.2.2", "react-scripts": "1.0.17", "react-select": "^1.0.0-rc.10" }, "scripts": {

Why does `DEBUG=foo node index.js` fails in `scripts` section of `package.json`

血红的双手。 提交于 2019-12-02 01:37:55
I'm on Windows 10, but I'm using git bash . When running from git bash the following: DEBUG=foo node index.js it works fine and sets the environment variable DEBUG . But if I put it into the scripts section of the package.json : "scripts": { "start": "DEBUG=foo node index.js" }, and run the following from git bash I get the following error: $ npm start > nodejs@1.0.0 start C:\Users\maksym.koretskyi\Desktop\nodejs > DEBUG=foo node index.js 'DEBUG' is not recognized as an internal or external command, operable program or batch file. Why the behaviour? rsp It seems like you're running it on

Install npm package without dependencies

北城余情 提交于 2019-12-01 00:53:43
I am looking for best solution how to install npm package without it's dependencies described in it's package.json file. The goal is to change dependencies versions before install package. I can do it manually for one package by downloading source, but if you have many nested dependencies it becomes a problem. Here's a shell script that seems to get you the extracted files you need. #!/bin/bash package="$1" version=$(npm show ${package} version) archive="${package}-${version}.tgz" curl --silent --remote-name \ "https://registry.npmjs.org/${package}/-/${archive}" mkdir "${package}" tar xzf "$

NodeJS unsafe-perm not working on package.json

亡梦爱人 提交于 2019-12-01 00:11:09
问题 I'm trying to run a npm install command with a preinstall script at my package.json . I know it's antipattern but I need to run some scripts as root. It's working fine by adding a .npmrc file containing unsafe-perm = true to my root directory. But it's not working by add a config property in my package.json file: { "name": "foo", "version": "1.4.4", "config": { "unsafe-perm":true }, "scripts" : { "preinstall" : "npm install -g bower" } } // It is not working According with NPM config docs it

Unsupported platform for inotify@1.4.1: wanted {“os”:“linux”,“arch”:“any”}

南笙酒味 提交于 2019-12-01 00:08:10
问题 I am coming across a very bizarre error when installing packages for my webpack/reactjs application. I am currently trying to install npm install copy-webpack-plugin --save dev The build/start scripts fail and the following error is shown in the terminal: Unsupported platform for inotify@1.4.1: wanted {"os":"linux","arch":"any"} (current: {"os":"darwin","arch":"x64"}) This means absolutely noting to me and I cannot find any clear explanations online.I do not know why inotify is needed or when