npm init not creating package.json on my mac

10,063

Try this.

  1. Go to terminal.

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

    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.

terminal snapshot

Share:
10,063
Amen Ra
Author by

Amen Ra

I am metamorphosis personified. I am a web developer who specializes in Front End, Mobile Development programming primarily with JavaScript in the Document Object Model and on the Server Side. I am intermediate at Visual Basic, C#, and PHP .

Updated on June 04, 2022

Comments

  • Amen Ra
    Amen Ra almost 2 years

    When I try to create a package.json file using npm init I keep getting the following:

    npm http GET https://registry.npmjs.org/init
    npm http 304 https://registry.npmjs.org/init
    npm http GET https://registry.npmjs.org/daemon
    npm http 304 https://registry.npmjs.org/daemon
    [email protected] node_modules/init
    └── [email protected]
    

    What is wrong? I have looked everywhere and I cannot find an answer. Here is what I get when I run the following command:

    Amens-Mac-mini:~ amenmojara$ npm init =ddd
    npm http GET https://registry.npmjs.org/%3Dddd
    npm http GET https://registry.npmjs.org/init
    npm http 304 https://registry.npmjs.org/init
    npm http 404 https://registry.npmjs.org/%3Dddd
    npm ERR! 404 '%3Dddd' is not in the npm registry.
    npm ERR! 404 You should bug the author to publish it
    npm ERR! 404
    npm ERR! 404 Note that you can also install from a
    npm ERR! 404 tarball, folder, or http url, or git url.
    
    npm ERR! System Darwin 13.0.0
    npm ERR! command "/usr/local/Cellar/node/0.10.26/bin/node" "/usr/local/bin/npm" "install" "init"   "=ddd"
    npm ERR! cwd /Users/amenmojara
    npm ERR! node -v v0.10.26
    npm ERR! npm -v 1.4.3
    npm ERR! code E404
    npm ERR!
    npm ERR! Additional logging details can be found in:
    npm ERR!     /Users/amenmojara/npm-debug.log
    npm ERR! not ok code 0