标签: node-modules

等待来自 readline 模块(Node.Js)的用户输入

我正在创建一个模块来获得经验并缩短一些代码。我有一段代码以简化的方式使用 readline,例如var x = arkin.question("How old are you? ");. Readline 不会等待答案。它产生这个:

你几岁?不明确的

代码:

const readline = require('readline');

const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout
});

exports.question = function(q){

  var response;

  rl.setPrompt(q);
  rl.prompt();
  rl.on('line', (userInput) => {
    response = userInput;
    rl.close();
  });

  rl.on('close', () => {
    return response;
  });
}
Run Code Online (Sandbox Code Playgroud)

我这样称呼它:

var age = arkin.question("How old are you? ");
console.log(age);
Run Code Online (Sandbox Code Playgroud)

我曾尝试使用此代码:

rl.question(q, (userInput) => {
    rl.close;
    response = userInput;
    return response;
});
Run Code Online (Sandbox Code Playgroud)

然而我得到了同样的结果。在此先感谢您的帮助。

javascript readline node.js node-modules

4
推荐指数
1
解决办法
7102
查看次数

语义发布无法发布到 npm

我正在使用语义发布 npm 模块来执行 circle ci 中的发布。我收到以下错误

[语义释放] [@语义释放/npm] › ? 将版本 1.0.0 写入 /home/circleci/tmp npm ERR 中的 package.json!版本未更改,可能需要 --allow-same-version

npm 错误!可以在以下位置找到此运行的完整日志:npm ERR!
/home/circleci/.npm/_logs/2019-01-19T15_21_36_194Z-debug.log [3:21:36 PM] [语义发布] › ? 插件“@semantic-release/npm”的“准备”步骤失败 [3:21:36 PM] [semantic-release] › ? 运行语义发布时出错:{ 错误:命令失败:npm 版本 1.0.0 --no-git-tag-version npm ERR!版本未更改,可能需要 --allow-same-version

npm 错误!可以在以下位置找到此运行的完整日志:npm ERR!
/home/circleci/.npm/_logs/2019-01-19T15_21_36_194Z-debug.log

at makeError (/home/circleci/tmp/node_modules/execa/index.js:174:9)
at Promise.all.then.arr (/home/circleci/tmp/node_modules/execa/index.js:278:16)
at process._tickCallback (internal/process/next_tick.js:68:7)   code: 1,   stdout: '',   stderr:    'npm ERR! Version not changed,
Run Code Online (Sandbox Code Playgroud)

可能需要 --allow-same-version\n\nnpm ERR!可以在以下位置找到此运行的完整日志:\nnpm ERR!
/home/circleci/.npm/_logs/2019-01-19T15_21_36_194Z-debug.log\n',
失败:true,信号:null,cmd:'npm version 1.0.0 --no-git-tag-version',超时:假,被杀:假,插件名称:'@semantic-release/npm' } { 错误:命令失败:npm 版本 1.0.0 --no-git-tag-version …

node.js npm node-modules circleci semantic-release

4
推荐指数
1
解决办法
1720
查看次数

纱线安装命令时 ESOCKETTIMEDOUT 错误

您好,我在使用纱线时遇到了问题,但仅限于在一台计算机上。

当我运行“yarn install”时,某些软件包无法下载,并且出现此错误:ESOCKETTIMEDOUT: 屏幕截图

起初我只是认为存储库存在一些问题,但是:

1- 我可以通过网络浏览器下载软件包

2-我在另一台电脑上没有任何问题

我也尝试过最新版本的纱线,但仍然出现此错误

有人对此有所了解吗?

javascript node-modules yarnpkg

4
推荐指数
2
解决办法
7579
查看次数

使用纱线工作区时,如何强制将包安装到相关的 node_modules 中?

我喜欢 yarn 工作区,但我经常发现由于与外部工具不兼容,我不得不拉出一个特定的包。

主要问题是我在相关的 node_modules 中没有它们的源代码,但是在上面的几个级别(通常对于纱线工作区和节点来说是正常的)。

例如,当在相对路径中找不到“openzeppelin-eth”时,ZeppelinOS会给出以下错误消息:

找不到“openzeppelin-eth”的 zos.json 文件。确保它是由 npm 包提供的。

有没有办法强制复制一个包?我读过--focus,但这不是我需要的。

npm node-modules yarnpkg yarn-workspaces

4
推荐指数
1
解决办法
3017
查看次数

在 ReactJS 中构建纱线,分配失败 - JavaScript 堆内存不足

在本地环境中我没有问题,但是使用此脚本在 jenkins 上运行生产环境确实可以:

yarn install --production
yarn build
Run Code Online (Sandbox Code Playgroud)

构建大约需要 5 分钟,最后,jenkins 退出并显示此控制台输出错误:

+ yarn install --production
yarn install v1.9.4
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@1.2.9: The platform "linux" is incompatible with this module.
info "fsevents@1.2.9" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning " > bootstrap@4.3.1" has unmet peer dependency "jquery@1.9.1 - 3".
warning " > bootstrap@4.3.1" has unmet peer dependency "popper.js@^1.14.7".
warning " > google-maps-react@1.1.11" has incorrect peer dependency …
Run Code Online (Sandbox Code Playgroud)

node-modules reactjs yarnpkg yarn-lock.json

4
推荐指数
4
解决办法
2万
查看次数

Argon2 与节点 docker 容器

我有 NestJs 应用程序,可以在我的本地机器(Windows)上完美运行。现在我想为我的应用程序创建一个 docker 容器。当我尝试启动我的容器时,我遇到了 Argon2 的一个问题。我在容器上安装了所有需要的氩气。我的错误在哪里?

谢谢

internal/modules/cjs/loader.js:1025
  return process.dlopen(module, path.toNamespacedPath(filename));
                 ^

Error: Error loading shared library /usr/src/app/node_modules/argon2/build/Release/argon2.node: Exec format error
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:1025:18)
    at Module.load (internal/modules/cjs/loader.js:815:32)
    at Function.Module._load (internal/modules/cjs/loader.js:727:14)
    at Module.require (internal/modules/cjs/loader.js:852:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at load (/usr/src/app/node_modules/node-gyp-build/index.js:20:10)
    at Object.<anonymous> (/usr/src/app/node_modules/argon2/argon2.js:5:81)
    at Module._compile (internal/modules/cjs/loader.js:959:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
    at Module.load (internal/modules/cjs/loader.js:815:32)
Run Code Online (Sandbox Code Playgroud)

Dockerfile :

FROM node:12.13-alpine As development

WORKDIR /usr/src/app

COPY package*.json ./

# --no-cache: download package index on-the-fly, no need to cleanup afterwards
# --virtual: bundle packages, remove whole …
Run Code Online (Sandbox Code Playgroud)

node.js node-modules docker argon2-ffi nestjs

4
推荐指数
1
解决办法
1237
查看次数

从 ngx-image-cropper 返回文件以上传 - Angular

我正在使用ngx-image-cropper来裁剪我的图像。我需要从ngx-image-cropper 中检索裁剪后的图像才能上传。但是,我无法通过此检索 File 对象。

这是我用来在用户裁剪图像时触发的代码,

imageCropped(event: ImageCroppedEvent) {
    this.croppedImage = event.base64;
    this.cropperHeight = event.height;
    this.cropperWidth = event.width;
    this.croppedEvent =event.file;//This is how i tried to get file
}
Run Code Online (Sandbox Code Playgroud)

当我尝试上传文件时,它有一些错误。所以最好提供一种从 ngx-image-cropper 获取文件对象的方法

blob image file node-modules angular

4
推荐指数
2
解决办法
4091
查看次数

无法确定任务 ':app:mergeDebugAssets' 的依赖关系

当我在我的项目上运行 react-native run-android 时,我收到了 gradle 的构建错误。我已经用 npm uninstall --save react-native-ftp 卸载了 react-native-ftp,删除了 node_modules 的依赖,清除了 ./gradle 缓存文件。但是错误不断..

在我的环境窗口中,这个项目正常工作。

怎么回事?

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':app:mergeDebugAssets'.
> Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
   > Could not …
Run Code Online (Sandbox Code Playgroud)

android gradle npm node-modules react-native

4
推荐指数
2
解决办法
2万
查看次数

如何在 vanilla Javascript 文件中导入 nodejs 模块

如何在 vanilla Javascript 文件中导入 nodejs 模块?换句话说,我如何在 vanilla javascript 文件中使用我的 nodejs 模块进行前端脚本编写?

html javascript scripting node.js node-modules

4
推荐指数
2
解决办法
5122
查看次数

ModuleWithProviders&lt;T&gt; 需要 1 个类型参数 - angular-autofocus-fix

安装后 angular-autofocus-fix

导入了 AutofocusModule

当我运行 angular 项目时,它显示以下错误:

ERROR in node_modules/angular-autofocus-fix/index.d.ts:4:23 - error TS2314: Generic type 'ModuleWithProviders<T>' requires 1 type argument(s).
static forRoot(): ModuleWithProviders
Run Code Online (Sandbox Code Playgroud)

当我签入那个 node_mudule

我在我的项目中使用 angular 10。

javascript npm node-modules angular

4
推荐指数
1
解决办法
6034
查看次数