标签: node-modules

react-native-community/CheckBox 无法解析模块

这看起来像是一个简单的问题和一个简单的答案, npm install @react-native-community/checkbox 但它不起作用。我有一个错误说该包依赖于react-native-windows,所以我也下载了这个包,这导致无法解决我的问题。

我真的不明白为什么会发生...

这是我的 package.json:

{
  "main": "node_modules/expo/AppEntry.js",
  "scripts": {
    "start": "expo start",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "web": "expo start --web",
    "eject": "expo eject"
  },
  "dependencies": {
    "@react-native-community/checkbox": "^0.5.6",
    "expo": "~39.0.2",
    "expo-status-bar": "~1.0.2",
    "moviedb-promise": "^3.1.2",
    "react": "16.13.1",
    "react-dom": "16.13.1",
    "react-image": "^4.0.3",
    "react-native": "https://github.com/expo/react-native/archive/sdk-39.0.2.tar.gz",
    "react-native-web": "~0.13.12",
    "react-native-windows": "^1.0.0",
    "react-tinder-card": "^1.3.1"
  },
  "devDependencies": {
    "@babel/core": "~7.9.0"
  },
  "private": true
}

Run Code Online (Sandbox Code Playgroud)

编辑 在此输入图像描述

这是我的代码:

import React from 'react'
import { View, Text } from 'react-native';
import CheckBoxSetting …
Run Code Online (Sandbox Code Playgroud)

node-modules reactjs react-native expo

5
推荐指数
1
解决办法
6752
查看次数

node.js TypeError [ERR_INVALID_PROTOCOL]:不支持协议“http:”。预期“https:

下面给出 Node.js 代码,我尝试使用 https 作为项目所需但出现错误

类型错误 [ERR_INVALID_PROTOCOL]:不支持协议“http:”。预期为“https:”

const express = require("express");
var https = require("https");


const app = express();


app.get("/", function(req, res) {

    const url = "http://api.openweathermap.org/data/2.5/weather?q=Gwalior&appid=4b01458a2b74d57ff37f136f382ac4d5&units=metric";

    https.get(url, function(response) {
        console.log(response.statusCode)
    });
    res.send("Server is Up and Running");
})



app.listen(3000, function() {
    console.log("Server is running on port 3000.");
})
Run Code Online (Sandbox Code Playgroud)

完整的错误堆栈跟踪:

TypeError [ERR_INVALID_PROTOCOL]: Protocol "http:" not supported. Expected "https:"
    at new ClientRequest (_http_client.js:151:11)
    at request (https.js:316:10)
    at Object.get (https.js:320:15)
    at C:\Users\Public\Documents\WeatherProject\app.js:12:10
    at Layer.handle [as handle_request] (C:\Users\Public\Documents\WeatherProject\node_modules\express\lib\router\layer.js:95:5)
    at next (C:\Users\Public\Documents\WeatherProject\node_modules\express\lib\router\route.js:137:13)
    at Route.dispatch (C:\Users\Public\Documents\WeatherProject\node_modules\express\lib\router\route.js:112:3) …
Run Code Online (Sandbox Code Playgroud)

node.js express node-modules

5
推荐指数
1
解决办法
8218
查看次数

无法正式安装“无法读取未定义的属性‘种类’”

这个问题可能看起来很愚蠢,但就像两周前一样,我安装它没有任何问题。现在看起来是这样的: 正式安装

ng 添加@ngx-formly/schematics --ui-theme=material

我尝试在材料和 cdk 模块之后/之前安装它,但结果是相同的。我还尝试安装所有单独的正式模块(基于我之前创建的项目),但出现此错误:

The package that you are trying to add does not support schematics. You can try using a different version of the package or contact the package author to add ng-add support.
Run Code Online (Sandbox Code Playgroud)

我还尝试删除节点模块和yarn.lock并再次初始化它,但仍然不起作用。而且当我创建表单时它也不会显示。我也尝试用yarn add ...或-ui-theme=bootstrap来安装它,但结果是一样的。在安装之前也尝试过服务(在堆栈上的某个地方读取它),但它也不起作用。

我听说节点 v.15.6.0 有一些问题,但我不确定是否是这样。这也是我的版本:

Angular CLI 版本

纱线版本是 1.22.5

更新:我尝试使用纱线升级--最新升级所有软件包,然后再次正式安装。之后:

 ng add @ngx-formly/schematics --ui-theme=material
Run Code Online (Sandbox Code Playgroud)

我明白了:

An unhandled exception occurred: Cannot find module '@schematics/angular/utility/config'
Require stack:
- /home/wiktor/angular-material-template/node_modules/@ngx-formly/schematics/utils/ast.js
- /home/wiktor/angular-material-template/node_modules/@ngx-formly/schematics/src/ng-add/index.js
- /home/wiktor/angular-material-template/node_modules/@angular-devkit/schematics/tools/export-ref.js
- /home/wiktor/angular-material-template/node_modules/@angular-devkit/schematics/tools/index.js
- /home/wiktor/angular-material-template/node_modules/@angular/cli/utilities/json-schema.js
- /home/wiktor/angular-material-template/node_modules/@angular/cli/models/command-runner.js
- /home/wiktor/angular-material-template/node_modules/@angular/cli/lib/cli/index.js
- /usr/lib/node_modules/@angular/cli/lib/init.js
- /usr/lib/node_modules/@angular/cli/bin/ng …
Run Code Online (Sandbox Code Playgroud)

node.js node-modules angular-formly yarnpkg angular

5
推荐指数
1
解决办法
718
查看次数

npm 安装时 Mac 上的 inotify@1.4.6 平台不受支持

我正在尝试建立一个反应项目。但是,当我运行 npm install 时,它会抛出此错误:

npm ERR! code EBADPLATFORM
npm ERR! notsup Unsupported platform for inotify@1.4.6: wanted {"os":"linux","arch":"any"} (current: {"os":"darwin","arch":"x64"})
npm ERR! notsup Valid OS:    linux
npm ERR! notsup Valid Arch:  any
npm ERR! notsup Actual OS:   darwin
npm ERR! notsup Actual Arch: x64 
Run Code Online (Sandbox Code Playgroud)

显然,我的 Mac 似乎不支持这个库。我希望一些解决方法可以解决这个问题,而不是删除这个库。请建议我如何解决这个问题。

macos npm node-modules reactjs

5
推荐指数
1
解决办法
1648
查看次数

如何从现有的 package-lock.json 中提取最接近的 node.js 版本?

我的package-lock.json并且package.json没有指定用于在我的存储库中生成的node.js 版本package-lock.json。

我可以使用迭代node版本来nvm查看哪个版本git diff对我的存储库中的前一个package-lock文件的产量最小。我想知道是否有一种不那么详尽和繁琐的方法可以做到这一点。是否有任何提示可以从锁定文件中“逆向工程”或“提取”节点版本?

动机:我不想package-lock.json在每次提交时不断更改我的版本,并且在 CI 中始终使用相同的节点版本。

node.js node-modules npm-shrinkwrap npm-install package-lock.json

5
推荐指数
0
解决办法
1022
查看次数

NPM 安装总是失败,并在 .staging 文件夹中找不到 JSON 解析和文件

Npm 安装对我来说失败了

\n
    \n
  1. json解析异常(每次在不同位置)
  2. \n
  3. 在 .staging 警告中找不到文件
  4. \n
\n

我在节点:12.18.3,npm:6.14.6\n对于我的其他队友来说,它工作得很好

\n

我试过

\n

重新安装 Node 和 npm

\n

也尝试过 nvm

\n

npm 缓存清理 \xe2\x80\x93force

\n

删除了node_modules

\n

删除了 package-lock json

\n

还增加了缓冲区的大小

\n

http.postbuffer=524288000

\n

http.maxrequestbuffer=100M

\n

日志

\n

IN-GN-52242:ui amar.tangade$ npm install

\n
\n

云预安装 /Users/amar.tangade/Desktop/cloud/ui\nnodetasks/check-install.js

\n
\n

x----------------------------------------警告--------- ------------------------------x\nCloud ui 应在“/Users/amar.tangade/g/cloud /ui"\nx-------------------------------------------------------- - - - - - - - - - - - - - - - - - - - - X

\n

npm WARN …

node.js npm node-modules npm-install

5
推荐指数
1
解决办法
391
查看次数

找不到模块:导入 nodejieba 进行反应时无法解析“aws-sdk”

当我的脚本导入nodejieba时,我遇到了这个错误。
\n未找到名为 \xe3\x80\x8cModule:无法解析“C:\\Users\\user\\Documents\\cchatbigdata\\node_modules@mapbox\\node-pre-gyp\”中的“aws-sdk” \lib\\util'\xe3\x80\x8d
\n起初,反应运行良好,我的脚本工作正常。
\n然后我npm install nodejieba --save-dev \n并在 TestedData.js 中添加import nodejieba from 'nodejieba' 。
\n即使我不使用nodejieba的功能,我的反应也遇到了这个错误。
\n我开始搜索有关 无法解析'aws-sdk'的相关问题。
\n大多数人在使用webpack时遇到这个错误,但我不使用webpack,我只是导入nodejieba。
\n我尝试了解node_modules下的node-pre-gyp\\lib\\util。
\n但它是由React创建的(我使用npx create-react-app),所以我认为如果更改文件react可能会关闭。
\n我认为react和nodejieba之间有问题。
\n我的浏览器显示这些错误,我发现它们都与node-pre-gyp\\lib\\util有关。

\n
./node_modules/@mapbox/node-pre-gyp/lib/util/s3_setup.js\nModule not found: Can't resolve 'aws-sdk' in 'C:\\Users\\kevin\\Documents\\cchatbigdata\\node_modules\\@mapbox\\node-pre-gyp\\lib\\util'\nconsole.<computed> @ index.js:1\nhandleErrors @ webpackHotDevClient.js:174\npush../node_modules/react-dev-utils/webpackHotDevClient.js.connection.onmessage @ webpackHotDevClient.js:213\nindex.js:1 \n./node_modules/@mapbox/node-pre-gyp/lib/util/s3_setup.js\nModule not found: Can't resolve 'mock-aws-s3' in 'C:\\Users\\kevin\\Documents\\cchatbigdata\\node_modules\\@mapbox\\node-pre-gyp\\lib\\util'\nconsole.<computed> @ index.js:1\nhandleErrors @ webpackHotDevClient.js:174\npush../node_modules/react-dev-utils/webpackHotDevClient.js.connection.onmessage @ webpackHotDevClient.js:213\nindex.js:1 \n./node_modules/@mapbox/node-pre-gyp/lib/util/s3_setup.js\nModule not found: Can't resolve 'nock' in 'C:\\Users\\kevin\\Documents\\cchatbigdata\\node_modules\\@mapbox\\node-pre-gyp\\lib\\util'\nconsole.<computed> @ index.js:1\nhandleErrors @ webpackHotDevClient.js:174\npush../node_modules/react-dev-utils/webpackHotDevClient.js.connection.onmessage @ webpackHotDevClient.js:213\n
Run Code Online (Sandbox Code Playgroud)\n

也许必须修复node_modules下的node-pre-gyp。
\n这是我的 TestData.js

\n
import {useState, useEffect} from …
Run Code Online (Sandbox Code Playgroud)

node.js node-modules reactjs

5
推荐指数
1
解决办法
3006
查看次数

从其文件夹安装本地 NPM 包会忽略该包的“文件”配置

TL;DR 打包我的本地 npm 包工作正常,它忽略非分发文件,但从它的文件夹安装它包括所有文件。

环境:

  • 节点:v14
  • 国家公共管理机构:v7
  • 通天塔:V7

我有一个小型可重用组件库 ( ./common/components),我想在我的应用程序之间共享。我正在使用 Babel 将其src代码构建到一个lib文件夹中 - 这似乎工作正常。当我运行npm pack命令时,我可以看到只有lib文件夹和package.json文件包含在包 TGZ 文件中。但是,当我使用 将该包安装在我的一个应用程序中时npm i ../../common/components,该包的所有代码(src、node_modules、.babelrc.json、package-lock.json等)都会包含在该应用程序的node_modules文件夹中。

我做错了什么,或者我误解了什么?有没有办法让我只安装lib文件夹?

这是我的组件包的代码:

  • package.json:

    {
      "name": "components",
      "version": "1.0.0",
      "main": "lib/*",
      "files": [
        "lib/*"
      ],
      "scripts": {
        "clean": "rimraf ./lib",
        "postinstall": "npm run build",
        "prebuild": "npm run clean",
        "build": "babel src --out-dir lib --copy-files" …
    Run Code Online (Sandbox Code Playgroud)

node.js npm node-modules babeljs npm-install

5
推荐指数
0
解决办法
1049
查看次数

找不到模块:无法解析“pg-native”

我正在尝试进行简单的用户登录,并且想将哈希值和盐存储在 PostgreSQL 数据库中。

const {Client} = require("pg");
const bcrypt = require('bcrypt');


const client = new Client({
   user:"xxxxxxx",
   host:"xxxxxxxxxxxxxxxxxx",
   database:"xxxxxxxxx",
   password:"xxxxxxxxxxxxxxxxxxxxxxx",
   port: 1234
});
   
client.connect()

const saltRounds: number = 10;

const newUserHash = (username: String, password: String) => {
    bcrypt.genSalt(saltRounds, function(err: Error, salt: String) {
        bcrypt.hash(password, salt, function(err: Error, hash: String) {
            //send it to database
        });
    });
}
Run Code Online (Sandbox Code Playgroud)

但我不断收到此错误;Module not found: Can't resolve 'pg-native'。使用import pg from 'pg'对我来说不起作用,我不知道该怎么办了。

database postgresql node-modules

5
推荐指数
0
解决办法
3438
查看次数

package.json 中的“exports”属性在工作区中是否有效?

我有一个 npm 包设置如下

project
|
|-- package.json
|
|-- workspace_a
|   |-- package.json
|   |-- index.js
|
|-- workspace_b
|   |-- package.json
|   |
|   |-- src
|   |   |-- index.js
|   |   |
|   |   |-- folder_1
|   |   |   |-- index.js
|   |   |
|   |   |-- folder_2
|   |       |-- index.js
|   |
|   |-- dist
|       |-- index.js
|       |
|       |-- folder_1
|       |   |-- index.js
|       |
|       |-- folder_2
|           |-- index.js
Run Code Online (Sandbox Code Playgroud)

主项目文件已针对工作区进行了正确配置,工作区的project.json …

javascript node.js npm node-modules npm-workspaces

5
推荐指数
0
解决办法
231
查看次数