Reputation: 398
i set the default config for the package.json file using the command,
npm config set init-main "script.js"
after this i initialized a folder using
npm init --yes
but the main is still "index.js". But, if i write
npm config get init-main
it returns "script.js". I could not find anything related in the documentation. Please help. Thanks in advance.
Upvotes: 1
Views: 7038
Reputation: 8195
Unfortunately, npm config set
allows you to set anything, eg. you can do something like:
npm config set foo "bar"
npm config get foo # outputs: bar
You probably just want to edit in package.json
the field main
to "index.js"
, there does not appear to exist any such config for npm (no init-main
described https://docs.npmjs.com/misc/config). Maybe an older/unstable verion had it?
(npm config should probably show a warning or somerhing in this case, like "warning, unrecognized config 'init-main'", but it doesn't...)
Upvotes: 0