npm init not working in powershell

1.9k views Asked by At

When I issue npm init in Powershell ISE to start a new nodejs project, it seems to hang at "Press ^C at any time to quit.":

    PS C:\> cd testnpm

    PS C:\testnpm> npm init
    This utility will walk you through creating a package.json file.
    It only covers the most common items, and tries to guess sensible defaults.

    See `npm help json` for definitive documentation on these fields
    and exactly what they do.

    Use `npm install <pkg> --save` afterwards to install a package and
    save it as a dependency in the package.json file.

    Press ^C at any time to quit.

Has anyone encountered this and knows what is wrong?

1

There are 1 answers

0
Alexander On

This works. If I include --force parameter in npm init, it will run it with all the defaults.

    PS C:\temp\npminit> npm init --force
    npm : npm WARN using --force I sure hope you know what you are doing.
    At line:1 char:1
    + npm init --force
    + ~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (npm WARN using ... you are doing.:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

    Wrote to C:\temp\npminit\package.json:

    {
        "name": "npminit",
        "version": "1.0.0",
        "description": "",
        "main": "index.js",
        "scripts": {
            "test": "echo \"Error: no test specified\" && exit 1"
        },
        "keywords": [],
        "author": "",
        "license": "ISC"
    }   


    PS C:\temp\npminit>