npm 初始化错误 - 无法创建应用程序

问题描述 投票:0回答:2

NodeJS 全新

当尝试创建新应用程序时,会出现以下情况: 它不会创建,而是在该位置退出并显示错误日志

H:\app>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.
name: (app)

H:\app>

错误日志内容:

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'init' ]
2 info using [email protected]
3 info using [email protected]
4 verbose stack Error: read EINVAL
4 verbose stack     at exports._errnoException (util.js:1018:11)
4 verbose stack     at TTY.onread (net.js:568:26)
5 verbose cwd H:\app
6 error Windows_NT 6.1.7601
7 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "init"
8 error node v6.11.0
9 error npm  v3.10.10
10 error code EINVAL
11 error errno EINVAL
12 error syscall read
13 error read EINVAL
14 error If you need help, you may report this error at:
14 error     <https://github.com/npm/npm/issues>
15 verbose exit [ 1, true ]

非常感谢任何帮助!

node.js node-modules
2个回答
0
投票

尝试这个命令:

npm init - y

默认情况下,上面的命令将在当前目录创建默认的 package.json。似乎访问方面存在一些问题。创建默认的 package.json 文件后,您可以稍后更新它。


0
投票

NodeJS 也是新手。在我运行之前,我无法提示创建 JSON 文件甚至其调查问卷:

`npm init --yes` 

npm init
,也:
npm init --y
,都不适合我。 (我在 Windows 上)。 希望这对新手有帮助!

© www.soinside.com 2019 - 2024. All rights reserved.