npm init不在powershell中工作

时间:2016-12-21 13:45:36

标签: npm powershell-ise

当我在 Powershell ISE 中发出npm init以启动一个新的nodejs项目时,它似乎挂在“按^ C随时退出。”:

    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.

有没有人遇到过这个并知道出了什么问题?

1 个答案:

答案 0 :(得分:0)

这很有效。如果我在npm init中包含--force参数,它将使用所有默认值运行它。

    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>