package.json

How to sync `yarn.lock` with `package.json`?

时光总嘲笑我的痴心妄想 提交于 2019-12-08 14:31:50
问题 I installed a package with yarn add --dev , run its setup process and during it, the package installed several other packages and added those to package.json (in devDependencies ), I assume with npm . Great, but now my yarn.lock is out of sync. What is the correct, non-manual way of syncing yarn.lock to the current state of package.json ? Edit: yarn check shows the missing packages as: error Lockfile does not contain pattern: <package>@<version> But it doesn't add them. 回答1: Run yarn install

How to give a custom url in package.json for a package

隐身守侯 提交于 2019-12-08 09:11:53
问题 I have done customization in a npm package inside node_modules folder. Now I want to deploy it on heroku . But what heroku does is It will see the package.json and install the fresh package . So someone suggested me to provide the custom url for a npm package , So that Heroku will download the npm package from this custom url not from npm. How can I achieve the same? 回答1: You should fork this package, make customization on your fork and install your version as a project dependency npm install

How to install npm packages within Google Dialogflow Fullfilment Inline Editor

让人想犯罪 __ 提交于 2019-12-07 08:55:13
问题 I would like to install some npm packages into my chatbot but I cant make this working. package.json file looks as below: { "name": "dialogflowFirebaseFulfillment", "description": "This is the default fulfillment for a Dialogflow agents using Cloud Functions for Firebase", "version": "0.0.1", "private": true, "license": "Apache Version 2.0", "author": "Google Inc.", "engines": { "node": "~6.0" }, "scripts": { "start": "firebase serve --only functions:dialogflowFirebaseFulfillment", "deploy":

Setting process.env var in package.json

穿精又带淫゛_ 提交于 2019-12-07 08:12:17
问题 I am trying to set and retrieve node app process.env vars using package.json, so by researching the issue, I've found an example to set / retrieve process.env through the 'config' section, so I added a new config section as shown below : "config" : { "var1" : "test", "var2" : "test2", "var3" : "test3" }, But I couldn't access any of the above vars from server.js using for example: console.log(process.env.npm_package_config_var1); So I was wondering how I can set / retrieve process.env var

how to use gitlab repo in NPM with package.json

痴心易碎 提交于 2019-12-07 07:53:19
问题 I'm working on a internal project and want to share a tools inside the group. but if I use the npm tools. it either request the module has registered on npm website or public git repo. I'm using gitlab. and there is a private token. git+https://gitlab-ci-token:\<private token>@<domain>/<username>/<repo_name>.git i tried to put it like this in package.json but it's not working. Is there a way to install a private gitlab repo with authorization? thanks a lot. 回答1: If I understand your question

How do I make my NPM package show “npm WARN prefer global” when installing locally

浪尽此生 提交于 2019-12-07 07:33:39
问题 Hard to google the subj — too many user questions, mine is about package development. I want a user of my package see "npm WARN prefer global" when installing it not globally. I thought npm install yo used to have such a warning but now it does not. At least I cannot see it. My environment: › npm --version 1.4.10 › node -v v0.10.28 回答1: Ben Fortune's answer specifies how an npm package author can designate a package as preferring global installation (by adding key-value pair "preferGlobal":

EACCES: permission denied, mkdir '/node_modules/node-sass/build' while running npm install on ubuntu

蹲街弑〆低调 提交于 2019-12-07 05:25:10
问题 i have an angular 4 app and i want to run it on ubuntu. i copied all project files , package.json and package-lock.json to a folder in winscp but i didn't copy node_modules! now when i run npm install, i get the errors like this: > node-sass@4.7.2 install /home/ubuntu/cms/node_modules/@angular/cli/node_modules/node-sass > node scripts/install.js Unable to save binary /home/ubuntu/cms/node_modules/@angular/cli/node_modules/node-sass/vendor/linux-x64-57 : { Error: EACCES: permission denied,

npm scripts: need to minify all HTML files in folder (and subfolders)

谁都会走 提交于 2019-12-07 04:51:39
问题 I want to minify all .html files in a folder (and any folders within) using npm run script. Ideally, all .html files should be overwritten (if that's not possible, a new folder is acceptable). It is assumed that there will be non-HTML files in the input folder. npm library minimize works only on per-file but not on folders. Another npm library html-minifier does accept folder as input, but fails if there are any non-HTML files present in the input folder: html-minifier --input-dir ./test1 -

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

六眼飞鱼酱① 提交于 2019-12-07 02:11:48
问题 I am currently trying to create a docker container for a node.js project that contains a local dependency. This seems to cause an issue with docker so as a workaround I am trying to just copy the local dependency folders and just ignore their dependency entries in the package.json file. Is there a way to specify dependencies I would like to ignore and have npm install run and skip those enties? 回答1: That can be done using devDependencies The npm modules which you require only to develop, e.g.

Should typescript @types packages version match their non types packages?

徘徊边缘 提交于 2019-12-07 01:02:37
问题 Do @types use the same versioning as the untyped package? npm i bluebird @types/bluebird -S gives me "@types/bluebird": "^3.5.0", "bluebird": "^3.5.0", Seems pretty reasonable. npm i request @types/request -S gives me "@types/request": "0.0.41", "request": "^2.81.0", Now this scares me a bit. Does this mean that we only have request types for request version 0.0.41? 回答1: Should typescript @types packages version match their non types packages? No. TypeScript types for JS packages is best