node.js - npm init 错误 - 无法创建应用程序

标签 node.js node-modules

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 npm@3.10.10
3 info using node@v6.11.0
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 ]

非常感谢任何帮助!

最佳答案

尝试此命令:npm init - y

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

关于node.js - npm init 错误 - 无法创建应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44934121/

相关文章:

javascript - 从 Node.js v12 升级到 Node.js v16.4.0 后 knex 坏了

css - 如何从样式化组件访问子项的 css 值?

Javascript(NodeJs) - 将数组和对象转换为批量插入 mysql(Sequelize)

javascript - 为什么找不到带有 '$all' 修饰符的文档?

javascript - 如何要求深层嵌套的 NodeJS 模块?

angular - 我有一个新项目,但是当执行 ng serve 时,我得到错误

angular - npm 相当于 yarn install 和 yarn webpack :build

eclipse - 如何使用 Supervisor 在没有命令提示符的情况下运行 Node js 应用程序(如果我想在 Eclipse 中运行)

node.js - Node 应用程序在网络请求后不会终止?

node.js - 如何将所有现有的全局 NPM 包安装到本地目录中?