The data contained in this repository can be downloaded to your computer using one of several clients.
Please see the documentation of your version control software client for more information.

Please select the desired protocol below to get the URL.

This URL has Read-Only access.

Statistics
| Branch: | Revision:

main_repo / deps / npm / man / man1 / json.1 @ d46ebffb

History | View | Annotate | Download (21.1 KB)

1
.\" Generated with Ronnjs 0.3.8
2
.\" http://github.com/kapouer/ronnjs/
3
.
4
.TH "NPM\-JSON" "1" "April 2013" "" ""
5
.
6
.SH "NAME"
7
\fBnpm-json\fR \-\- Specifics of npm\'s package\.json handling
8
.
9
.SH "DESCRIPTION"
10
This document is all you need to know about what\'s required in your package\.json
11
file\.  It must be actual JSON, not just a JavaScript object literal\.
12
.
13
.P
14
A lot of the behavior described in this document is affected by the config
15
settings described in \fBnpm help config\fR\|\.
16
.
17
.SH "DEFAULT VALUES"
18
npm will default some values based on package contents\.
19
.
20
.IP "\(bu" 4
21
\fB"scripts": {"start": "node server\.js"}\fR
22
.
23
.IP
24
If there is a \fBserver\.js\fR file in the root of your package, then npm
25
will default the \fBstart\fR command to \fBnode server\.js\fR\|\.
26
.
27
.IP "\(bu" 4
28
\fB"scripts":{"preinstall": "node\-waf clean || true; node\-waf configure build"}\fR
29
.
30
.IP
31
If there is a \fBwscript\fR file in the root of your package, npm will
32
default the \fBpreinstall\fR command to compile using node\-waf\.
33
.
34
.IP "\(bu" 4
35
\fB"scripts":{"preinstall": "node\-gyp rebuild"}\fR
36
.
37
.IP
38
If there is a \fBbinding\.gyp\fR file in the root of your package, npm will
39
default the \fBpreinstall\fR command to compile using node\-gyp\.
40
.
41
.IP "\(bu" 4
42
\fB"contributors": [\.\.\.]\fR
43
.
44
.IP
45
If there is an \fBAUTHORS\fR file in the root of your package, npm will
46
treat each line as a \fBName <email> (url)\fR format, where email and url
47
are optional\.  Lines which start with a \fB#\fR or are blank, will be
48
ignored\.
49
.
50
.IP "" 0
51
.
52
.SH "name"
53
The \fImost\fR important things in your package\.json are the name and version fields\.
54
Those are actually required, and your package won\'t install without
55
them\.  The name and version together form an identifier that is assumed
56
to be completely unique\.  Changes to the package should come along with
57
changes to the version\.
58
.
59
.P
60
The name is what your thing is called\.  Some tips:
61
.
62
.IP "\(bu" 4
63
Don\'t put "js" or "node" in the name\.  It\'s assumed that it\'s js, since you\'re
64
writing a package\.json file, and you can specify the engine using the "engines"
65
field\.  (See below\.)
66
.
67
.IP "\(bu" 4
68
The name ends up being part of a URL, an argument on the command line, and a
69
folder name\. Any name with non\-url\-safe characters will be rejected\.
70
Also, it can\'t start with a dot or an underscore\.
71
.
72
.IP "\(bu" 4
73
The name will probably be passed as an argument to require(), so it should
74
be something short, but also reasonably descriptive\.
75
.
76
.IP "\(bu" 4
77
You may want to check the npm registry to see if there\'s something by that name
78
already, before you get too attached to it\.  http://registry\.npmjs\.org/
79
.
80
.IP "" 0
81
.
82
.SH "version"
83
The \fImost\fR important things in your package\.json are the name and version fields\.
84
Those are actually required, and your package won\'t install without
85
them\.  The name and version together form an identifier that is assumed
86
to be completely unique\.  Changes to the package should come along with
87
changes to the version\.
88
.
89
.P
90
Version must be parseable by node\-semver \fIhttps://github\.com/isaacs/node\-semver\fR, which is bundled
91
with npm as a dependency\.  (\fBnpm install semver\fR to use it yourself\.)
92
.
93
.P
94
Here\'s how npm\'s semver implementation deviates from what\'s on semver\.org:
95
.
96
.IP "\(bu" 4
97
Versions can start with "v"
98
.
99
.IP "\(bu" 4
100
A numeric item separated from the main three\-number version by a hyphen
101
will be interpreted as a "build" number, and will \fIincrease\fR the version\.
102
But, if the tag is not a number separated by a hyphen, then it\'s treated
103
as a pre\-release tag, and is \fIless than\fR the version without a tag\.
104
So, \fB0\.1\.2\-7 > 0\.1\.2\-7\-beta > 0\.1\.2\-6 > 0\.1\.2 > 0\.1\.2beta\fR
105
.
106
.IP "" 0
107
.
108
.P
109
This is a little bit confusing to explain, but matches what you see in practice
110
when people create tags in git like "v1\.2\.3" and then do "git describe" to generate
111
a patch version\.
112
.
113
.SH "description"
114
Put a description in it\.  It\'s a string\.  This helps people discover your
115
package, as it\'s listed in \fBnpm search\fR\|\.
116
.
117
.SH "keywords"
118
Put keywords in it\.  It\'s an array of strings\.  This helps people
119
discover your package as it\'s listed in \fBnpm search\fR\|\.
120
.
121
.SH "homepage"
122
The url to the project homepage\.
123
.
124
.P
125
\fBNOTE\fR: This is \fInot\fR the same as "url"\.  If you put a "url" field,
126
then the registry will think it\'s a redirection to your package that has
127
been published somewhere else, and spit at you\.
128
.
129
.P
130
Literally\.  Spit\.  I\'m so not kidding\.
131
.
132
.SH "bugs"
133
The url to your project\'s issue tracker and / or the email address to which
134
issues should be reported\. These are helpful for people who encounter issues
135
with your package\.
136
.
137
.P
138
It should look like this:
139
.
140
.IP "" 4
141
.
142
.nf
143
{ "url" : "http://github\.com/owner/project/issues"
144
, "email" : "project@hostname\.com"
145
}
146
.
147
.fi
148
.
149
.IP "" 0
150
.
151
.P
152
You can specify either one or both values\. If you want to provide only a url,
153
you can specify the value for "bugs" as a simple string instead of an object\.
154
.
155
.P
156
If a url is provided, it will be used by the \fBnpm bugs\fR command\.
157
.
158
.SH "license"
159
You should specify a license for your package so that people know how they are
160
permitted to use it, and any restrictions you\'re placing on it\.
161
.
162
.P
163
The simplest way, assuming you\'re using a common license such as BSD or MIT, is
164
to just specify the name of the license you\'re using, like this:
165
.
166
.IP "" 4
167
.
168
.nf
169
{ "license" : "BSD" }
170
.
171
.fi
172
.
173
.IP "" 0
174
.
175
.P
176
If you have more complex licensing terms, or you want to provide more detail
177
in your package\.json file, you can use the more verbose plural form, like this:
178
.
179
.IP "" 4
180
.
181
.nf
182
"licenses" : [
183
  { "type" : "MyLicense"
184
  , "url" : "http://github\.com/owner/project/path/to/license"
185
  }
186
]
187
.
188
.fi
189
.
190
.IP "" 0
191
.
192
.P
193
It\'s also a good idea to include a license file at the top level in your package\.
194
.
195
.SH "people fields: author, contributors"
196
The "author" is one person\.  "contributors" is an array of people\.  A "person"
197
is an object with a "name" field and optionally "url" and "email", like this:
198
.
199
.IP "" 4
200
.
201
.nf
202
{ "name" : "Barney Rubble"
203
, "email" : "b@rubble\.com"
204
, "url" : "http://barnyrubble\.tumblr\.com/"
205
}
206
.
207
.fi
208
.
209
.IP "" 0
210
.
211
.P
212
Or you can shorten that all into a single string, and npm will parse it for you:
213
.
214
.IP "" 4
215
.
216
.nf
217
"Barney Rubble <b@rubble\.com> (http://barnyrubble\.tumblr\.com/)
218
.
219
.fi
220
.
221
.IP "" 0
222
.
223
.P
224
Both email and url are optional either way\.
225
.
226
.P
227
npm also sets a top\-level "maintainers" field with your npm user info\.
228
.
229
.SH "files"
230
The "files" field is an array of files to include in your project\.  If
231
you name a folder in the array, then it will also include the files
232
inside that folder\. (Unless they would be ignored by another rule\.)
233
.
234
.P
235
You can also provide a "\.npmignore" file in the root of your package,
236
which will keep files from being included, even if they would be picked
237
up by the files array\.  The "\.npmignore" file works just like a
238
"\.gitignore"\.
239
.
240
.SH "main"
241
The main field is a module ID that is the primary entry point to your program\.
242
That is, if your package is named \fBfoo\fR, and a user installs it, and then does \fBrequire("foo")\fR, then your main module\'s exports object will be returned\.
243
.
244
.P
245
This should be a module ID relative to the root of your package folder\.
246
.
247
.P
248
For most modules, it makes the most sense to have a main script and often not
249
much else\.
250
.
251
.SH "bin"
252
A lot of packages have one or more executable files that they\'d like to
253
install into the PATH\. npm makes this pretty easy (in fact, it uses this
254
feature to install the "npm" executable\.)
255
.
256
.P
257
To use this, supply a \fBbin\fR field in your package\.json which is a map of
258
command name to local file name\. On install, npm will symlink that file into \fBprefix/bin\fR for global installs, or \fB\|\./node_modules/\.bin/\fR for local
259
installs\.
260
.
261
.P
262
For example, npm has this:
263
.
264
.IP "" 4
265
.
266
.nf
267
{ "bin" : { "npm" : "\./cli\.js" } }
268
.
269
.fi
270
.
271
.IP "" 0
272
.
273
.P
274
So, when you install npm, it\'ll create a symlink from the \fBcli\.js\fR script to \fB/usr/local/bin/npm\fR\|\.
275
.
276
.P
277
If you have a single executable, and its name should be the name
278
of the package, then you can just supply it as a string\.  For example:
279
.
280
.IP "" 4
281
.
282
.nf
283
{ "name": "my\-program"
284
, "version": "1\.2\.5"
285
, "bin": "\./path/to/program" }
286
.
287
.fi
288
.
289
.IP "" 0
290
.
291
.P
292
would be the same as this:
293
.
294
.IP "" 4
295
.
296
.nf
297
{ "name": "my\-program"
298
, "version": "1\.2\.5"
299
, "bin" : { "my\-program" : "\./path/to/program" } }
300
.
301
.fi
302
.
303
.IP "" 0
304
.
305
.SH "man"
306
Specify either a single file or an array of filenames to put in place for the \fBman\fR program to find\.
307
.
308
.P
309
If only a single file is provided, then it\'s installed such that it is the
310
result from \fBman <pkgname>\fR, regardless of its actual filename\.  For example:
311
.
312
.IP "" 4
313
.
314
.nf
315
{ "name" : "foo"
316
, "version" : "1\.2\.3"
317
, "description" : "A packaged foo fooer for fooing foos"
318
, "main" : "foo\.js"
319
, "man" : "\./man/doc\.1"
320
}
321
.
322
.fi
323
.
324
.IP "" 0
325
.
326
.P
327
would link the \fB\|\./man/doc\.1\fR file in such that it is the target for \fBman foo\fR
328
.
329
.P
330
If the filename doesn\'t start with the package name, then it\'s prefixed\.
331
So, this:
332
.
333
.IP "" 4
334
.
335
.nf
336
{ "name" : "foo"
337
, "version" : "1\.2\.3"
338
, "description" : "A packaged foo fooer for fooing foos"
339
, "main" : "foo\.js"
340
, "man" : [ "\./man/foo\.1", "\./man/bar\.1" ]
341
}
342
.
343
.fi
344
.
345
.IP "" 0
346
.
347
.P
348
will create files to do \fBman foo\fR and \fBman foo\-bar\fR\|\.
349
.
350
.P
351
Man files must end with a number, and optionally a \fB\|\.gz\fR suffix if they are
352
compressed\.  The number dictates which man section the file is installed into\.
353
.
354
.IP "" 4
355
.
356
.nf
357
{ "name" : "foo"
358
, "version" : "1\.2\.3"
359
, "description" : "A packaged foo fooer for fooing foos"
360
, "main" : "foo\.js"
361
, "man" : [ "\./man/foo\.1", "\./man/foo\.2" ]
362
}
363
.
364
.fi
365
.
366
.IP "" 0
367
.
368
.P
369
will create entries for \fBman foo\fR and \fBman 2 foo\fR
370
.
371
.SH "directories"
372
The CommonJS Packages \fIhttp://wiki\.commonjs\.org/wiki/Packages/1\.0\fR spec details a
373
few ways that you can indicate the structure of your package using a \fBdirectories\fR
374
hash\. If you look at npm\'s package\.json \fIhttp://registry\.npmjs\.org/npm/latest\fR,
375
you\'ll see that it has directories for doc, lib, and man\.
376
.
377
.P
378
In the future, this information may be used in other creative ways\.
379
.
380
.SS "directories\.lib"
381
Tell people where the bulk of your library is\.  Nothing special is done
382
with the lib folder in any way, but it\'s useful meta info\.
383
.
384
.SS "directories\.bin"
385
If you specify a "bin" directory, then all the files in that folder will
386
be used as the "bin" hash\.
387
.
388
.P
389
If you have a "bin" hash already, then this has no effect\.
390
.
391
.SS "directories\.man"
392
A folder that is full of man pages\.  Sugar to generate a "man" array by
393
walking the folder\.
394
.
395
.SS "directories\.doc"
396
Put markdown files in here\.  Eventually, these will be displayed nicely,
397
maybe, someday\.
398
.
399
.SS "directories\.example"
400
Put example scripts in here\.  Someday, it might be exposed in some clever way\.
401
.
402
.SH "repository"
403
Specify the place where your code lives\. This is helpful for people who
404
want to contribute\.  If the git repo is on github, then the \fBnpm docs\fR
405
command will be able to find you\.
406
.
407
.P
408
Do it like this:
409
.
410
.IP "" 4
411
.
412
.nf
413
"repository" :
414
  { "type" : "git"
415
  , "url" : "http://github\.com/isaacs/npm\.git"
416
  }
417
"repository" :
418
  { "type" : "svn"
419
  , "url" : "http://v8\.googlecode\.com/svn/trunk/"
420
  }
421
.
422
.fi
423
.
424
.IP "" 0
425
.
426
.P
427
The URL should be a publicly available (perhaps read\-only) url that can be handed
428
directly to a VCS program without any modification\.  It should not be a url to an
429
html project page that you put in your browser\.  It\'s for computers\.
430
.
431
.SH "scripts"
432
The "scripts" member is an object hash of script commands that are run
433
at various times in the lifecycle of your package\.  The key is the lifecycle
434
event, and the value is the command to run at that point\.
435
.
436
.P
437
See \fBnpm help scripts\fR to find out more about writing package scripts\.
438
.
439
.SH "config"
440
A "config" hash can be used to set configuration
441
parameters used in package scripts that persist across upgrades\.  For
442
instance, if a package had the following:
443
.
444
.IP "" 4
445
.
446
.nf
447
{ "name" : "foo"
448
, "config" : { "port" : "8080" } }
449
.
450
.fi
451
.
452
.IP "" 0
453
.
454
.P
455
and then had a "start" command that then referenced the \fBnpm_package_config_port\fR environment variable, then the user could
456
override that by doing \fBnpm config set foo:port 8001\fR\|\.
457
.
458
.P
459
See \fBnpm help config\fR and \fBnpm help scripts\fR for more on package
460
configs\.
461
.
462
.SH "dependencies"
463
Dependencies are specified with a simple hash of package name to version
464
range\. The version range is EITHER a string which has one or more
465
space\-separated descriptors, OR a range like "fromVersion \- toVersion"
466
.
467
.P
468
\fBPlease do not put test harnesses in your \fBdependencies\fR hash\.\fR  See \fBdevDependencies\fR, below\.
469
.
470
.P
471
Version range descriptors may be any of the following styles, where "version"
472
is a semver compatible version identifier\.
473
.
474
.IP "\(bu" 4
475
\fBversion\fR Must match \fBversion\fR exactly
476
.
477
.IP "\(bu" 4
478
\fB=version\fR Same as just \fBversion\fR
479
.
480
.IP "\(bu" 4
481
\fB>version\fR Must be greater than \fBversion\fR
482
.
483
.IP "\(bu" 4
484
\fB>=version\fR etc
485
.
486
.IP "\(bu" 4
487
\fB<version\fR
488
.
489
.IP "\(bu" 4
490
\fB<=version\fR
491
.
492
.IP "\(bu" 4
493
\fB~version\fR See \'Tilde Version Ranges\' below
494
.
495
.IP "\(bu" 4
496
\fB1\.2\.x\fR See \'X Version Ranges\' below
497
.
498
.IP "\(bu" 4
499
\fBhttp://\.\.\.\fR See \'URLs as Dependencies\' below
500
.
501
.IP "\(bu" 4
502
\fB*\fR Matches any version
503
.
504
.IP "\(bu" 4
505
\fB""\fR (just an empty string) Same as \fB*\fR
506
.
507
.IP "\(bu" 4
508
\fBversion1 \- version2\fR Same as \fB>=version1 <=version2\fR\|\.
509
.
510
.IP "\(bu" 4
511
\fBrange1 || range2\fR Passes if either range1 or range2 are satisfied\.
512
.
513
.IP "\(bu" 4
514
\fBgit\.\.\.\fR See \'Git URLs as Dependencies\' below
515
.
516
.IP "" 0
517
.
518
.P
519
For example, these are all valid:
520
.
521
.IP "" 4
522
.
523
.nf
524
{ "dependencies" :
525
  { "foo" : "1\.0\.0 \- 2\.9999\.9999"
526
  , "bar" : ">=1\.0\.2 <2\.1\.2"
527
  , "baz" : ">1\.0\.2 <=2\.3\.4"
528
  , "boo" : "2\.0\.1"
529
  , "qux" : "<1\.0\.0 || >=2\.3\.1 <2\.4\.5 || >=2\.5\.2 <3\.0\.0"
530
  , "asd" : "http://asdf\.com/asdf\.tar\.gz"
531
  , "til" : "~1\.2"
532
  , "elf" : "~1\.2\.3"
533
  , "two" : "2\.x"
534
  , "thr" : "3\.3\.x"
535
  }
536
}
537
.
538
.fi
539
.
540
.IP "" 0
541
.
542
.SS "Tilde Version Ranges"
543
A range specifier starting with a tilde \fB~\fR character is matched against
544
a version in the following fashion\.
545
.
546
.IP "\(bu" 4
547
The version must be at least as high as the range\.
548
.
549
.IP "\(bu" 4
550
The version must be less than the next major revision above the range\.
551
.
552
.IP "" 0
553
.
554
.P
555
For example, the following are equivalent:
556
.
557
.IP "\(bu" 4
558
\fB"~1\.2\.3" = ">=1\.2\.3 <1\.3\.0"\fR
559
.
560
.IP "\(bu" 4
561
\fB"~1\.2" = ">=1\.2\.0 <1\.3\.0"\fR
562
.
563
.IP "\(bu" 4
564
\fB"~1" = ">=1\.0\.0 <1\.1\.0"\fR
565
.
566
.IP "" 0
567
.
568
.SS "X Version Ranges"
569
An "x" in a version range specifies that the version number must start
570
with the supplied digits, but any digit may be used in place of the x\.
571
.
572
.P
573
The following are equivalent:
574
.
575
.IP "\(bu" 4
576
\fB"1\.2\.x" = ">=1\.2\.0 <1\.3\.0"\fR
577
.
578
.IP "\(bu" 4
579
\fB"1\.x\.x" = ">=1\.0\.0 <2\.0\.0"\fR
580
.
581
.IP "\(bu" 4
582
\fB"1\.2" = "1\.2\.x"\fR
583
.
584
.IP "\(bu" 4
585
\fB"1\.x" = "1\.x\.x"\fR
586
.
587
.IP "\(bu" 4
588
\fB"1" = "1\.x\.x"\fR
589
.
590
.IP "" 0
591
.
592
.P
593
You may not supply a comparator with a version containing an x\.  Any
594
digits after the first "x" are ignored\.
595
.
596
.SS "URLs as Dependencies"
597
Starting with npm version 0\.2\.14, you may specify a tarball URL in place
598
of a version range\.
599
.
600
.P
601
This tarball will be downloaded and installed locally to your package at
602
install time\.
603
.
604
.SS "Git URLs as Dependencies"
605
Git urls can be of the form:
606
.
607
.IP "" 4
608
.
609
.nf
610
git://github\.com/user/project\.git#commit\-ish
611
git+ssh://user@hostname:project\.git#commit\-ish
612
git+ssh://user@hostname/project\.git#commit\-ish
613
git+http://user@hostname/project/blah\.git#commit\-ish
614
git+https://user@hostname/project/blah\.git#commit\-ish
615
.
616
.fi
617
.
618
.IP "" 0
619
.
620
.P
621
The \fBcommit\-ish\fR can be any tag, sha, or branch which can be supplied as
622
an argument to \fBgit checkout\fR\|\.  The default is \fBmaster\fR\|\.
623
.
624
.SH "devDependencies"
625
If someone is planning on downloading and using your module in their
626
program, then they probably don\'t want or need to download and build
627
the external test or documentation framework that you use\.
628
.
629
.P
630
In this case, it\'s best to list these additional items in a \fBdevDependencies\fR hash\.
631
.
632
.P
633
These things will be installed whenever the \fB\-\-dev\fR configuration flag
634
is set\.  This flag is set automatically when doing \fBnpm link\fR or when doing \fBnpm install\fR from the root of a package, and can be managed like any other npm
635
configuration param\.  See \fBnpm help config\fR for more on the topic\.
636
.
637
.SH "bundledDependencies"
638
Array of package names that will be bundled when publishing the package\.
639
.
640
.P
641
If this is spelled \fB"bundleDependencies"\fR, then that is also honorable\.
642
.
643
.SH "optionalDependencies"
644
If a dependency can be used, but you would like npm to proceed if it
645
cannot be found or fails to install, then you may put it in the \fBoptionalDependencies\fR hash\.  This is a map of package name to version
646
or url, just like the \fBdependencies\fR hash\.  The difference is that
647
failure is tolerated\.
648
.
649
.P
650
It is still your program\'s responsibility to handle the lack of the
651
dependency\.  For example, something like this:
652
.
653
.IP "" 4
654
.
655
.nf
656
try {
657
  var foo = require(\'foo\')
658
  var fooVersion = require(\'foo/package\.json\')\.version
659
} catch (er) {
660
  foo = null
661
}
662
if ( notGoodFooVersion(fooVersion) ) {
663
  foo = null
664
}
665
// \.\. then later in your program \.\.
666
if (foo) {
667
  foo\.doFooThings()
668
}
669
.
670
.fi
671
.
672
.IP "" 0
673
.
674
.P
675
Entries in \fBoptionalDependencies\fR will override entries of the same name in \fBdependencies\fR, so it\'s usually best to only put in one place\.
676
.
677
.SH "engines"
678
You can specify the version of node that your stuff works on:
679
.
680
.IP "" 4
681
.
682
.nf
683
{ "engines" : { "node" : ">=0\.1\.27 <0\.1\.30" } }
684
.
685
.fi
686
.
687
.IP "" 0
688
.
689
.P
690
And, like with dependencies, if you don\'t specify the version (or if you
691
specify "*" as the version), then any version of node will do\.
692
.
693
.P
694
If you specify an "engines" field, then npm will require that "node" be
695
somewhere on that list\. If "engines" is omitted, then npm will just assume
696
that it works on node\.
697
.
698
.P
699
You can also use the "engines" field to specify which versions of npm
700
are capable of properly installing your program\.  For example:
701
.
702
.IP "" 4
703
.
704
.nf
705
{ "engines" : { "npm" : "~1\.0\.20" } }
706
.
707
.fi
708
.
709
.IP "" 0
710
.
711
.P
712
Note that, unless the user has set the \fBengine\-strict\fR config flag, this
713
field is advisory only\.
714
.
715
.SH "engineStrict"
716
If you are sure that your module will \fIdefinitely not\fR run properly on
717
versions of Node/npm other than those specified in the \fBengines\fR hash,
718
then you can set \fB"engineStrict": true\fR in your package\.json file\.
719
This will override the user\'s \fBengine\-strict\fR config setting\.
720
.
721
.P
722
Please do not do this unless you are really very very sure\.  If your
723
engines hash is something overly restrictive, you can quite easily and
724
inadvertently lock yourself into obscurity and prevent your users from
725
updating to new versions of Node\.  Consider this choice carefully\.  If
726
people abuse it, it will be removed in a future version of npm\.
727
.
728
.SH "os"
729
You can specify which operating systems your
730
module will run on:
731
.
732
.IP "" 4
733
.
734
.nf
735
"os" : [ "darwin", "linux" ]
736
.
737
.fi
738
.
739
.IP "" 0
740
.
741
.P
742
You can also blacklist instead of whitelist operating systems,
743
just prepend the blacklisted os with a \'!\':
744
.
745
.IP "" 4
746
.
747
.nf
748
"os" : [ "!win32" ]
749
.
750
.fi
751
.
752
.IP "" 0
753
.
754
.P
755
The host operating system is determined by \fBprocess\.platform\fR
756
.
757
.P
758
It is allowed to both blacklist, and whitelist, although there isn\'t any
759
good reason to do this\.
760
.
761
.SH "cpu"
762
If your code only runs on certain cpu architectures,
763
you can specify which ones\.
764
.
765
.IP "" 4
766
.
767
.nf
768
"cpu" : [ "x64", "ia32" ]
769
.
770
.fi
771
.
772
.IP "" 0
773
.
774
.P
775
Like the \fBos\fR option, you can also blacklist architectures:
776
.
777
.IP "" 4
778
.
779
.nf
780
"cpu" : [ "!arm", "!mips" ]
781
.
782
.fi
783
.
784
.IP "" 0
785
.
786
.P
787
The host architecture is determined by \fBprocess\.arch\fR
788
.
789
.SH "preferGlobal"
790
If your package is primarily a command\-line application that should be
791
installed globally, then set this value to \fBtrue\fR to provide a warning
792
if it is installed locally\.
793
.
794
.P
795
It doesn\'t actually prevent users from installing it locally, but it
796
does help prevent some confusion if it doesn\'t work as expected\.
797
.
798
.SH "private"
799
If you set \fB"private": true\fR in your package\.json, then npm will refuse
800
to publish it\.
801
.
802
.P
803
This is a way to prevent accidental publication of private repositories\.
804
If you would like to ensure that a given package is only ever published
805
to a specific registry (for example, an internal registry),
806
then use the \fBpublishConfig\fR hash described below
807
to override the \fBregistry\fR config param at publish\-time\.
808
.
809
.SH "publishConfig"
810
This is a set of config values that will be used at publish\-time\.  It\'s
811
especially handy if you want to set the tag or registry, so that you can
812
ensure that a given package is not tagged with "latest" or published to
813
the global public registry by default\.
814
.
815
.P
816
Any config values can be overridden, but of course only "tag" and
817
"registry" probably matter for the purposes of publishing\.
818
.
819
.P
820
See \fBnpm help config\fR to see the list of config options that can be
821
overridden\.
822
.
823
.SH "SEE ALSO"
824
.
825
.IP "\(bu" 4
826
npm help semver
827
.
828
.IP "\(bu" 4
829
npm help init
830
.
831
.IP "\(bu" 4
832
npm help version
833
.
834
.IP "\(bu" 4
835
npm help config
836
.
837
.IP "\(bu" 4
838
npm help help
839
.
840
.IP "\(bu" 4
841
npm help faq
842
.
843
.IP "\(bu" 4
844
npm help install
845
.
846
.IP "\(bu" 4
847
npm help publish
848
.
849
.IP "\(bu" 4
850
npm help rm
851
.
852
.IP "" 0
853