无法解决已安装的 Npm 模块
Cant Resolve Installed Npm Module
我从我的反应应用程序的服务器端卸载了包@toast-ui/react-image-editor因为我认为依赖需要是客户端,所以我去安装它客户端,然后重新启动应用程序但它不能被发现。
这是我的基本文件夹结构
-myapp
-server.js
-package.json
-node_modules
-package-lock.json
-client
-package.json
-node_modules
-package-lock.json
-src
我收到此错误:“./src/components/images/Editor.js
找不到模块:无法在 'C:..\client\src\components\images'"
中解析 '@toast-ui/react-image-editor'
下面我咨询了
How do I resolve "Cannot find module" error using Node.js?
基本上我已经删除并安装了单个包,在客户端和服务器上删除并安装了 node_modules 运行 npm 缓存验证,仅在客户端安装了包,安装了包在客户端和服务器上,仅安装在服务器上。
没有任何效果,这让我觉得可能是 VS Code 的导入错误,
有没有办法查看 npm 如何尝试导入特定的包或我没有做的任何一般事情,因为 React 无法导入显然存在的包。
我遇到了同样的错误。 I think there is a problem with the recent version 3.14.3. 我回到了 3.14.2,它运行良好。这是我的示例 App.js,可帮助您入门,基于 npm 页面。
import 'tui-image-editor/dist/tui-image-editor.css';
import ImageEditor from '@toast-ui/react-image-editor';
function App() {
const myTheme = {
// Theme object to extends default dark theme.
};
const MyComponent = () => (
<ImageEditor
includeUI={{
theme: myTheme,
menu: ['shape', 'filter'],
initMenu: 'filter',
uiSize: {
width: '1000px',
height: '700px',
},
menuBarPosition: 'bottom',
}}
cssMaxHeight={500}
cssMaxWidth={700}
selectionStyle={{
cornerSize: 20,
rotatingPointOffset: 70,
}}
usageStatistics={true}
/>
);
return (
<div className="App">
<header className="App-header">
<div><MyComponent /></div>
</header>
</div>
);
}
export default App;
我从我的反应应用程序的服务器端卸载了包@toast-ui/react-image-editor因为我认为依赖需要是客户端,所以我去安装它客户端,然后重新启动应用程序但它不能被发现。
这是我的基本文件夹结构
-myapp
-server.js
-package.json
-node_modules
-package-lock.json
-client
-package.json
-node_modules
-package-lock.json
-src
我收到此错误:“./src/components/images/Editor.js 找不到模块:无法在 'C:..\client\src\components\images'"
中解析 '@toast-ui/react-image-editor'下面我咨询了
How do I resolve "Cannot find module" error using Node.js?
基本上我已经删除并安装了单个包,在客户端和服务器上删除并安装了 node_modules 运行 npm 缓存验证,仅在客户端安装了包,安装了包在客户端和服务器上,仅安装在服务器上。
没有任何效果,这让我觉得可能是 VS Code 的导入错误,
有没有办法查看 npm 如何尝试导入特定的包或我没有做的任何一般事情,因为 React 无法导入显然存在的包。
我遇到了同样的错误。 I think there is a problem with the recent version 3.14.3. 我回到了 3.14.2,它运行良好。这是我的示例 App.js,可帮助您入门,基于 npm 页面。
import 'tui-image-editor/dist/tui-image-editor.css';
import ImageEditor from '@toast-ui/react-image-editor';
function App() {
const myTheme = {
// Theme object to extends default dark theme.
};
const MyComponent = () => (
<ImageEditor
includeUI={{
theme: myTheme,
menu: ['shape', 'filter'],
initMenu: 'filter',
uiSize: {
width: '1000px',
height: '700px',
},
menuBarPosition: 'bottom',
}}
cssMaxHeight={500}
cssMaxWidth={700}
selectionStyle={{
cornerSize: 20,
rotatingPointOffset: 70,
}}
usageStatistics={true}
/>
);
return (
<div className="App">
<header className="App-header">
<div><MyComponent /></div>
</header>
</div>
);
}
export default App;