npm-not-package.json

npm init not creating package.json on mac

See https://www.npmjs.com/package/npm-autoinit

1
2
3
$ npm ls

npm ERR! error in /tmp/tmpdir/R3semq: ENOENT: no such file or directory, open '/tmp/tmpdir/R3semq/package.json'

I often use temporary directories to play/experiment with packages and hustling with package.json every time I want to check out some package is not an option for me.

This module will make npm run

1
npm init --yes

automatically for you if it sees fit.

See https://github.com/npm/npm/issues/9161

备注:在对应的文件夹下运行

1
npm init --yes

See http://stackoverflow.com/questions/21982785/npm-init-not-creating-package-json-on-my-mac

Try this.

  1. Go to terminal.

  2. Change directory location where you want to create a file.

    1
    cd your_destination_folder
  3. Type npm init and press enter.

  4. It ask for name, version, description, entry point, test command, git repository, keywords, author, license. Pass those values.

  5. Then it prompt, Is this ok? (yes). Enter yes.

Hurray, your package.json file is created.