在React Native中添加NPM模块引发错误(无法解析模块url)

在React Native中添加NPM模块引发错误(无法解析模块url),npm,react-native,Npm,React Native,具体地说,我正在react native中使用元提取器模块 'use strict'; //import React Native import React, { Component } from 'react'; import { Text, StyleSheet, View, TextInput, TouchableHighlight, } from 'react-native'; var styles = require('../styles/styles');

具体地说,我正在react native中使用
元提取器
模块

'use strict';
//import React Native
import React, { Component } from 'react';
import {
  Text,
  StyleSheet,
  View,
  TextInput,
  TouchableHighlight, 
} from 'react-native';


var styles = require('../styles/styles');
var metagetplus = require('../../node_modules/meta-extractor');
以下是错误消息:

无法从/Users/name/Desktop/instaldr/node_modules/meta extractor/index.js解析模块url:无法在其模块映射或/Users/node_modules/url下的任何节点模块目录及其父目录中找到此模块 这可能与

要解决此问题,请尝试以下操作: 1.清除看守人手表:
watchman watch del all
。 2.删除
node\u模块
文件夹:
rm-rf node\u模块和&npm安装
。 3.重置打包机缓存:
rm-fr$TMPDIR/react-*
npm start--Reset cache


我尝试了该链接中提到的所有建议的解决方法,但似乎都无法解决问题。有人能帮我吗?

导入已更改的组件,如果不再使用require,请尝试:
从('meta-extractor')导入metagetplus

导入已更改的组件,不应再使用require,请尝试:
从('meta-extractor')导入metagetplus

1。你看到package.json了吗。。。如果package.json中没有列出包“meta extractor”,它可能会破坏整个系统? 2.尝试使用commonjs require方法:

const metagetplus = require('meta-extractor');
有时模块只与commonjs require方法一起工作。。。它可能不会一直与导入语句一起工作。包“元提取器”已经有一段时间没有更新了,所以它可能无法与导入语句一起工作

所以你能做的就是

一,。清除看守人:
watchman watch del all
2.清除节点模块:
rm-rf节点模块和npm安装
3.安装软件包:
npm i元提取器
4.编辑代码文件:

'use strict';
import React, { Component } from 'react';
import {
  Text,
  StyleSheet,
  View,
  TextInput,
  TouchableHighlight, 
} from 'react-native';


const styles = require('../styles/styles');
const metagetplus = require('meta-extractor');

希望它能起作用…

1。你看到package.json了吗。。。如果package.json中没有列出包“meta extractor”,它可能会破坏整个系统? 2.尝试使用commonjs require方法:

const metagetplus = require('meta-extractor');
有时模块只与commonjs require方法一起工作。。。它可能不会一直与导入语句一起工作。包“元提取器”已经有一段时间没有更新了,所以它可能无法与导入语句一起工作

所以你能做的就是

一,。清除看守人:
watchman watch del all
2.清除节点模块:
rm-rf节点模块和npm安装
3.安装软件包:
npm i元提取器
4.编辑代码文件:

'use strict';
import React, { Component } from 'react';
import {
  Text,
  StyleSheet,
  View,
  TextInput,
  TouchableHighlight, 
} from 'react-native';


const styles = require('../styles/styles');
const metagetplus = require('meta-extractor');

希望它能工作…

如果
元提取器
模块在您的节点模块中,您就不能
要求('meta-extractor')
?最初我是这样保存的。没有工作。如果
元提取器
模块在您的node\u模块中,您就不能
要求('meta-extractor')
?最初我是这样保存的。无法工作。
从('meta-extractor')导入metagetplus抛出“意外令牌”错误。
从“元提取器”导入metagetplus
给出问题中提到的错误。
从('meta-extractor')导入metagetplus抛出“意外令牌”错误。
从“元提取器”导入metagetplus给出问题中提到的错误。