标签: node-modules

删除用yarn创建的补丁

由于参数@shoutem/ui有限制,ref我添加了一个补丁,以通过添加以下内容来尊重 ref 实现ref={(input) => this.props.inputRef(input)}:

@shoute/ui TextView 路径。

该团队最终没有使用这条路径,而是创建了一种不同的方法来解决该问题。我想回滚这个补丁。我找不到删除补丁的方法,就像添加补丁一样简单。我已经检查了文档,但找不到有关它的详细信息。

我也尝试过:

yarn patch-package package-name --reverse
Run Code Online (Sandbox Code Playgroud)

检查此处文档的“选项”--reverse标题下的https://yarnpkg.com/package/patch-package。

前任。:yarn patch-package @shoutem/ui --reverese

即使在那之后,当我运行时yarn install,我也会在我的补丁列表(检查图像)中看到我想要删除的内容。

--反向测试

patch node-modules react-native yarnpkg

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

TypeScript:如何仅将“allowSyntheticDefaultImports”应用于node_modules?

对于上下文,我尝试对此问题应用解决方法:https://github.com/TooTallNate/node-proxy-agent/issues/62

该库中的打字稿无法编译,错误是node_modules/https-proxy-agent/dist/agent.d.ts:2:8 - error TS1192: Module '"net"' has no default export.“这阻止了我自己的代码编译”。解决方法是将其放在我的 tsconfig.json 中:

"allowSyntheticDefaultImports": true
Run Code Online (Sandbox Code Playgroud)

我不希望这适用于我的所有代码,只是这个库/所有node_modules。如何仅为我的 node_modules 打开此设置?

javascript node.js node-modules typescript tsconfig

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

NPM:在 Mac OS 上运行安装时出现 libsass 错误

我第一次尝试在本地运行旧版 React 应用程序。我使用的是装有 Big Sur 11.5.2 的新 Mac M1。我的节点版本是 16.9.0,我将 python3 设置为默认值(尽管该应用程序似乎正在寻找 python2)。我还将 CommandLineTools 升级到了最新版本。

但是当我做一个简单的操作时npm install,我收到很多警告,最后出现这个错误:

npm ERR! /Users/cd/.node-gyp/16.9.0/include/node/v8-internal.h:489:38: error: no template named 'remove_cv_t' in namespace 'std'; did you mean 'remove_cv'?
npm ERR!             !std::is_same<Data, std::remove_cv_t<T>>::value>::Perform(data);
npm ERR!                                 ~~~~~^~~~~~~~~~~
npm ERR!                                      remove_cv
npm ERR! /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/type_traits:776:50: note: 'remove_cv' declared here
npm ERR! template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_cv
npm ERR!                                                  ^
npm ERR! 1 error generated.
npm ERR! make: *** [Release/obj.target/binding/src/binding.o] Error 1
npm ERR! gyp ERR! build error …
Run Code Online (Sandbox Code Playgroud)

node.js npm node-modules node-sass npm-install

5
推荐指数
2
解决办法
3802
查看次数

Node_Modules 文件夹在“npm install”后消失

每当我在新计算机上的项目上运行“npm install”命令时,都会出现一些奇怪的行为。安装命令完成后,我的 node_modules 文件夹就会消失。任何帮助表示赞赏!

这是日志:

PS C:\Dev\eth> npm i

npm WARN deprecated truffle-hdwallet-provider@0.0.3: WARNING: This package has been renamed to @truffle/hdwallet-provider.
npm WARN deprecated uuid@3.3.2: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm …
Run Code Online (Sandbox Code Playgroud)

javascript node.js npm node-modules

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

如何减小 Puppeteer 的大小

我使用 Puppeteer 进行网页抓取,并使用我制作的一个小型 NodeJs Web 应用程序。这个网络应用程序托管在 Heroku 上并且可以jontewks/puppeteer-heroku-buildpack正常工作。

我面临的问题是,由于 Heroku 大小限制,我的应用程序不再构建:

Compiled slug size: 537.4M is too large (max is 500M).
Run Code Online (Sandbox Code Playgroud)

我尝试过几件事:

  • 使用 Firefox 代替 Chromium
  • 通过删除文件来减小 Chromium 的大小interactive_ui_tests.exe
    • 我无法执行此操作,因为 Heroku 使用 Linux 而不是 Windows,并且 Linux Chromium 发行版中不存在此文件
  • 使用headless_shell而不是 Chromium
    • 我坚持这个(就像这里),因为我不明白如何让它发挥作用。我找到了要在此处使用的文件,但我面临着与 07/09/2018 的评论相同的问题
  • 使用剧作家而不是木偶师
    • 这可能是一个解决方案,但我正在使用诸如puppeteer-extra和 之类的东西puppeteer-extra-plugin-stealth,所以改变它很麻烦
  • 通过删除文件夹来减小 Chromium 的大小locales
    • 有一点帮助,但不多
  • 使用旧版本的 Puppeteer ( 2.1.1),它使用旧版本的 Chromium,稍微轻一些
    • 目前,这是我唯一有效的解决方案
  • 使用命令heroku repo:gc -a …

heroku chromium node.js node-modules puppeteer

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

无法解析模块react/jsx-runtime

在此输入图像描述

“依赖关系”:{“@react-native-community/masked-view”:“0.1.10”,“@react-navigation/native”:“^ 5.8.10”,“@react-navigation/stack”:“ ^5.12.8", "expo": "^44.0.1", "expo-status-bar": "~1.2.0", "react": "^16.13.1", "react-dom": " 16.13.1", "react-native": "^0.64.3", "react-native-gesture-handler": "~2.1.0", "react-native-paper": "^4.11.1", “react-native-reanimated”:“~2.3.1”,“react-native-safe-area-context”:“3.3.2”,“react-native-screens”:“~3.10.1”,“react -native-status-bar-height": "^2.6.0", "react-native-web": "~0.13.12" },

node-modules react-native

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

React - 错误:尝试运行 npm start 时找不到模块 React

我在尝试为 React 应用程序运行“npm start”时遇到了一个错误。

我的应用程序在开发过程中基本上按照我的预期运行,但是我遇到了一个错误,需要我更新我的节点版本作为潜在的修复。我将 node 更新到 v16.13.2,并且还决定将 np​​m 更新到 v8.3.2。现在,当尝试运行 npm start 时,我收到以下错误。我还发现奇怪的是引用的文件不是来自我当前项目文件夹中的目录。

到目前为止我已经尝试过以下操作:

  1. 删除 package-lock.json 和 node_modules 文件夹,然后使用 npm install 重新安装。
  2. 重新启动我的电脑。
  3. npm 安装反应脚本。

我想知道是否有人可以帮忙解决?

    node:internal/modules/cjs/loader:936
  throw err;
  ^

    Error: Cannot find module 'react'
    Require stack:
     - C:\Users\shane\AppData\Roaming\npm\node_modules\react-scripts\scripts\start.js
        at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
        at Function.resolve (node:internal/modules/cjs/helpers:108:19)
        at Object.<anonymous> (C:\Users\shane\AppData\Roaming\npm\node_modules\react-scripts\scripts\start.js:52:31)
        at Module._compile (node:internal/modules/cjs/loader:1101:14)
        at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
        at Module.load (node:internal/modules/cjs/loader:981:32)
        at Function.Module._load (node:internal/modules/cjs/loader:822:12)
        at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
        at node:internal/main/run_main_module:17:47 {
      code: 'MODULE_NOT_FOUND',
      requireStack: [
        'C:\\Users\\shane\\AppData\\Roaming\\npm\\node_modules\\react-scripts\\scripts\\start.js'
      ]
    }
Run Code Online (Sandbox Code Playgroud)

包.json

    {
  "name": "faucet", …
Run Code Online (Sandbox Code Playgroud)

javascript node.js npm node-modules reactjs

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

React - StoryBook - 从 node_modules 导入我的组件时出错

我有一个 React 项目,其中包含相当多的组件,我想安装 StoryBook 以便能够查阅它们。

为此,我将 StoryBook 作为主项目之外的项目安装,保留文件夹结构如下:

c:\development\MyProject
c:\development\StoryBook
Run Code Online (Sandbox Code Playgroud)

在 StoryBook 内部,我在Button.stories.jsx文件中添加了以下“导入” ,该文件管理安装中默认提供的按钮部分。

import SmallButton from 'MyProject/Buttons/SmallButton';
Run Code Online (Sandbox Code Playgroud)

为了使其工作并能够导入我的组件,我在StoryBook 项目内的node_modules文件夹内创建了一个符号链接。

c:\development\StoryBook\node_modules\MyProject <== symbolic link to c:\development\MyProject\src
Run Code Online (Sandbox Code Playgroud)

当我使用纱线故事书启动 StoryBook 时,它找到我的组件文件,但出现以下我无法解决的错误:

ERROR in ../MyProject/src/components/VSNButtons/SmallButton/index.js 10:12
Module parse failed: Unexpected token (10:12)
File was processed with these loaders:
 * ./node_modules/@storybook/preset-create-react-app/node_modules/@pmmmwh/react-refresh-webpack-plugin
/loader/index.js
You may need an additional loader to handle the result of these loaders.
|         const className = "ep-action " + (this.props.disabled ? "disabled " : " ") + …
Run Code Online (Sandbox Code Playgroud)

node-modules reactjs storybook

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

如何修复错误node_modules对打字稿的反应?

我尝试删除node_modules并重新安装它,但它不起作用。该项目运行良好,直到出现以下错误:

ERROR in ./node_modules/cookie-signature/index.js 4:13-30
Module not found: Error: Can't resolve 'crypto' in '/home/juandav/react-app-store/my-store/node_modules/cookie-signature'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
        - add a fallback 'resolve.fallback: { "crypto": require.resolve("crypto-browserify") }'
        - install 'crypto-browserify'
If you don't want to include a polyfill, you can use …
Run Code Online (Sandbox Code Playgroud)

node-modules typescript reactjs

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

ts-node 无法找到模块

*.ts我在使用 ts-node运行文件时遇到问题。

我的项目的目录结构如下所示。

-- project dir
   -- src
      -- services
         -- module1
             -- file1.ts  (classA)
             -- file2.ts  (classB)
             -- index.ts  (contains export statements like export * from file1.ts)
   -- application.ts
Run Code Online (Sandbox Code Playgroud)

这是我在tsconfig.json文件中配置的内容。

{
  "compilerOptions": {
    "lib": [
      "es2020",
      "dom"
    ],
    "baseUrl": ".",
    "paths": {
      "@src/*": ["src/*"],
      "@tests/*": ["tests/*"],
    },
    "module": "CommonJS",
    "target": "es2020",
    "strict": true,
    "alwaysStrict": true,
    "declaration": true,
    "noImplicitAny": true,
    "strictNullChecks": true,
    "noImplicitThis": true,
    "esModuleInterop": true,
    "skipLibCheck": true,
    "forceConsistentCasingInFileNames": true,
    "resolveJsonModule": true,
    "noImplicitReturns": true,
    "inlineSourceMap": true,
    "inlineSources": …
Run Code Online (Sandbox Code Playgroud)

node.js node-modules typescript ts-node

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