我收到了以下错误
error TS7016: Could not find a declaration file for module 'react-native-camera'. '/Users/ilja/Documents/Repositories/blok/node_modules/react-native-camera/index.js' implicitly has an 'any' type.
Try `npm install @types/react-native-camera` if it exists or add a new declaration (.d.ts) file containing `declare module 'react-native-camera';`
Run Code Online (Sandbox Code Playgroud)
作为我在typings/index.d.ts项目根目录创建的快速修复程序(没有@ types/react-native-camera)文件并填充它
declare module 'react-native-camera';
Run Code Online (Sandbox Code Playgroud)
然后,在我的tsconfig文件中,我将它添加到我的类型根源中
"typeRoots": ["node_modules/@types", "./typings"],
Run Code Online (Sandbox Code Playgroud)
但是当我构建时我仍然遇到同样的错误,导致我认为我的实现不正确,我错过了什么?
编辑,我的完整tsconfig看起来像这样
{
"compilerOptions": {
"target": "ES6",
"module": "commonjs",
"lib": ["es7"],
"allowJs": true,
"checkJs": true,
"jsx": "react-native",
"removeComments": true,
"outDir": "./dist",
"typeRoots": ["node_modules/@types", "./typings"],
"experimentalDecorators": true,
"noFallthroughCasesInSwitch": true,
"noImplicitReturns": true,
"noUnusedLocals": true,
"noUnusedParameters": …Run Code Online (Sandbox Code Playgroud) node-modules typescript reactjs react-native typescript-typings
有没有办法对yarn linkdist 或 lib 文件夹进行处理?
这是我的代码结构:
/package-a
- package.json
- src/
- ...
- dist/
- ...
Run Code Online (Sandbox Code Playgroud)
如果我对另一个项目做cd dist && yarn link和做yarn link package-a,它会链接package-a根文件夹而不是 dist,使导入看起来像这样:
import fn from 'package-a/dist/fn';
Run Code Online (Sandbox Code Playgroud)
而不是简单地:
import fn from 'package-a/fn';
Run Code Online (Sandbox Code Playgroud)
除了手动执行符号链接之外,还有什么方法可以使这项工作?
我已经解决了有关此问题的所有问题,但似乎找不到任何可行的方法。
我收到此错误:-
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-sass@4.11.0 postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass@4.11.0 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Run Code Online (Sandbox Code Playgroud)
我试图再次删除 node_modules 和 npm install。我还尝试删除 node_modules 中的 node-sass 文件夹,但 npm install -g node-sass@latest 也不起作用。我也试过
npm install -g node --unsafe-perm=true --allow-root
Run Code Online (Sandbox Code Playgroud)
和
npm uninstall node-sass
npm cache clean --force
npm install -g node-sass@latest …Run Code Online (Sandbox Code Playgroud) 我正在做一个 react 项目,在实现这个包https://www.npmjs.com/package/react-bootstrap-typeahead后出现以下错误,然后出现以下错误。
Failed to compile
./node_modules/react-popper/lib/cjs/Popper.js
Module not found: Can't resolve '@babel/runtime/helpers/objectWithoutPropertiesLoose' in 'E:\reactjs\deveans-react-version\node_modules\react-popper\lib\cjs'
This error occurred during the build time and cannot be dismissed.
Run Code Online (Sandbox Code Playgroud)
我找到了很多解决方案,我也尝试过https://github.com/jquense/yup/issues/216但仍然遇到相同的错误。
但是当我删除 Typeahead 组件时,它工作正常。
import React , { Component } from 'react'
import {Typeahead} from 'react-bootstrap-typeahead';
import 'react-bootstrap-typeahead/css/Typeahead.css';
class States extends Component {
state = {
multiple: false,
options: [
{id: 1, label: 'Pakistan'},
{id: 2, label: 'Indonesia'},
{id: 3, label: 'Turkey'},
{id: 4, label: 'Brazil'},
]
};
render () …Run Code Online (Sandbox Code Playgroud) 在 Node 中使用 CommonJS 模块时,您可以使用require.main === module.
在 Node 中使用 ES 模块(带有--experimental-modules标志)时,检测脚本是否正在从命令行运行的等效方法是什么?
我正在尝试运行以下两个命令:
npm install
npm audit fix
Run Code Online (Sandbox Code Playgroud)
在 VS Code 中,当报告以下错误时。
error C2664: 'v8::String::Utf8Value::Utf8Value(const v8::String::Utf8Value &)': cannot conver
t argument 1 from 'v8::Local<v8::Value>' to 'const v8::String::Utf8Value &
Run Code Online (Sandbox Code Playgroud)
非常感谢任何帮助解决这个问题!!
我有多个应用程序想要共享相同的 eslint 配置:
- project_root/
- app1/
- node_modules/
- eslint.rc
- app2/
- node_modules/
- eslint.rc
- app3/
- node_modules/
- eslint.rc
- eslint.rc
Run Code Online (Sandbox Code Playgroud)
每个应用程序都有相同的配置:
module.exports = {
extends: [
'../.eslintrc',
],
};
Run Code Online (Sandbox Code Playgroud)
在根目录中,我想配置所有内容:
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
project: 'tsconfig.json',
sourceType: 'module',
},
plugins: ['@typescript-eslint/eslint-plugin'],
extends: [
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'prettier',
'prettier/@typescript-eslint',
],
root: true,
env: {
node: true,
jest: true,
},
rules: {},
};
Run Code Online (Sandbox Code Playgroud)
但是现在每个应用程序都会抛出无法找到节点模块的错误:
无法加载在“.eslintrc.js»../.eslintrc”中声明的解析器“@typescript-eslint/parser”:找不到模块“@typescript-eslint/parser”。
我在根目录中没有任何 node_modules,我想避免它。
我最近从官方网站下载了 Nodejs 文件,但我不知道如何从存档文件安装 Nodejs。
请帮助我如何安装此文件,以便我可以从 CLI 运行“npm”命令为我自己的项目安装多个软件包。
我是 Electron 的新手……我只是按照本指南进行操作:https : //www.geeksforgeeks.org/integrate-angular-7-with-electronjs/?ref=rp
但是,我不知道为什么,我无法继续第 4 步,访问电子,并在构建甚至只是服务时不断弹出它。
错误:node_modules/electron/electron.d.ts:6594:21 - 错误 TS2694:命名空间“NodeJS”没有导出成员“Require”。
6594 要求:NodeJS.Require; ~~~~~~~
npm 错误!代码 ELIFECYCLE npm ERR!错误号 1 npm 错误号!pemberkasan@0.2.0 电子:ng build --prod && electron .
npm ERR!退出状态 1 npm ERR!npm 错误!在 pemberkasan@0.2.0 电子脚本中失败。npm 错误!这可能不是 npm 的问题。上面可能有额外的日志输出。
我希望这里的任何人都理解这一点并能够解决这个问题。谢谢你!因为我的目标是使用我在 Angular 服务上触发的 ipcRenderer 连接 ipcMain。
我对使用节点和电子完全陌生。我正在运行入门文档,并按照描述运行后npm start遇到以下错误:
Class WebSwapCGLLayer is implemented in both /System/Library/Frameworks/WebKit.framework/Versions/A/Frameworks/WebCore.framework/Versions/A/Frameworks/libANGLE-shared.dylib (0x7ffa5dba6318) and myProjectDir/node_modules/electron/dist/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libGLESv2.dylib (0x10d69b9c8). One of the two will be used. Which one is undefined.
node_modules我如何指定应使用中包含的类?
node-modules ×10
node.js ×5
javascript ×3
reactjs ×3
electron ×2
node-sass ×2
npm ×2
npm-install ×2
angular ×1
es6-modules ×1
eslint ×1
npm-start ×1
prettier ×1
react-native ×1
typescript ×1
yarnpkg ×1