package.json

Deploy Angular 5 + Nodejs Express app to Heroku

浪尽此生 提交于 2019-12-03 04:57:15
I have an Angular 5 App. This is what I have in my package.json { "name": "web", "version": "0.0.0", "license": "MIT", "scripts": { "ng": "ng", "start": "node server.js", "build": "ng build", "test": "ng test", "lint": "ng lint", "e2e": "ng e2e", "postinstall": "ng build --aot --prod" }, "private": true, "dependencies": { "@angular/animations": "5.1.0", "@angular/cli": "^1.6.4", "@angular/common": "5.0.3", "@angular/compiler": "5.0.3", "@angular/compiler-cli": "5.0.3", "@angular/core": "5.0.3", "@angular/forms": "5.0.3", "@angular/http": "5.0.3", "@angular/platform-browser": "5.0.3", "@angular

How to install only “devDependencies” using npm

荒凉一梦 提交于 2019-12-03 04:28:37
问题 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. :( 回答1: Check the NPM docs for install: With the --production flag (or when the NODE_ENV environment variable is set

Root directory in package.json

天涯浪子 提交于 2019-12-03 04:09:57
My question concerns an existing library that I wish to publish as an NPM module. The library is already in use, and currently require d via the local file system. How can I specify the root directory of my module's files? If I have a structure like: . ├── package.json ├── src | ├── js | └────── lib | └───────── my | └───────────── thing.js | └───────────── that.js How do I specify that the root of my module, and accessible files is src/js/lib/my/ ? I would like to use as follows from an outside project: var thing = require('my/thing'), that = require('my/that'); I saw the "files" property in

How do I fix a vulnerable npm package in my package-lock.json that isn't listed in the package.json?

亡梦爱人 提交于 2019-12-03 04:04:33
问题 Github is telling me that a dependency in my package-lock.json file is vulnerable and outdated. The problem is that if I do npm install or npm update , neither of them update the dependency in the package-lock.json file. I've done a lot of googling on this, as well as deleted the file and done npm install . If anyone can help resolve this I'd hugely appreciate it. The package in question is Hoek, which I don't actually have in my package.json file. Many thanks in advance. 回答1: It sounds like

Make `npm install --save` add a strict version to package.json

无人久伴 提交于 2019-12-03 02:10:26
问题 When you run npm install --save somepackage , it usually adds something like this into package.json: "dependencies": { "somepackage": "^2.1.0" } Because the version is prepended with a caret(^), this means that if you later run npm install , it might install version 2.3.0 instead. This can be undesirable for fairly obvious reasons. npm shrinkwrap is useful, but doesn't really solve the problem. So, I have several questions: When installing a package, is it possible to specify that you want it

Change working directory for npm scripts

牧云@^-^@ 提交于 2019-12-03 01:58:33
Q: Is it possible to change the the context in which npm runs scripts? What I want to is the following: "scripts": { "test": "gulp mocha", "pre-install": "./deps/2.7/cpython/configure --prefix=$(pwd)/build --exec-prefix=$(pwd)/build && make -C deps/2.7/cpython && make -C deps/2.7/cpython install", "install": "node-gyp rebuild" }, Obviously cd deps/2.7/cpython/ && ./configure would work on UNIX-like systems but not on windows. Why: The root of the problem is, that the configure command of the python repo outputs files into the directory where it is called. The files however are build relevant

Angular 2 required libraries

。_饼干妹妹 提交于 2019-12-03 00:35:00
I would like to start working with the Angular2 Beta, but I am facing a few problems regarding the required libraries. I am using Eclipse and it's TypeScript Plugin . Also, I am using SystemJS as module loader. My problem is that if I install Angular2 using npm install angular2 it loads the whole Angular-Project, including the CommonJS -Version, ES6 -Version and the TypeScript -Version. This results in a over 30 MB big folder with almost 2000 files, though I only need the TypeScript -Version (still a few 100 files), without examples. Also, importing the /ts -folder in Eclipse gives me errors,

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

会有一股神秘感。 提交于 2019-12-02 18:50:12
问题 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"

How to configure package.json to run eslint script

不问归期 提交于 2019-12-02 17:53:36
So I am using eslint as a linter for my react project and I would like it to check all of my .js files. I am able to do this through the script: "lint": "eslint back/*.js && eslint backTest/*.js && eslint front/actions/*.js" how can I get it to examine every .js file recursively, something like: "lint": "eslint -r *.js" This would save me having to type out each file inidvidually Thanks in advance for the help eslint "**/*.js" to run on all js files in all the folders recursively (in the current folder) You can also do: AnyFolder/**/*.js And to ignore a folder: eslint "**/*.js" --ignore

How can I reference package version in npm script?

冷暖自知 提交于 2019-12-02 17:34:22
I want to reference my package version in a npm script so I can show current version in the app. Something like { "name": "bla", "version": "1.0.0", "author": "bla bla", "scripts": { "build": "node VERSION=<<package.version>> build/build.js" } } Is there a way to do this? 1) Referencing package version in npm-scripts. In npm-script 's you can reference the version using the variable npm_package_version . For example: Using a bash shell (E.g. Linux, macOS): { ... "version": "1.0.0", "scripts": { "build": "echo $npm_package_version" } } Note the $ prefix Using Windows (E.g. cmd.exe, Powershell):