【问题标题】:Module not found: Can't resolve 'watson-react-components'找不到模块:无法解析“watson-react-components”
【发布时间】:2018-07-24 08:49:00
【问题描述】:

我尝试在我的本地工作站上成功运行的 bluemix / IBMCloud 上运行 REACT 应用程序。

我收到错误 Module not found: Can't resolve 'watson-react-components' 当我调用应用程序时(部署到 bluemix 成功) 这里的 import 语句是我的 java 脚本代码

import React from 'react';
import './Conversation.css';
import { InputWithButton } from 'watson-react-components';
import Message from './Message.js';

我通过以下安装命令安装包

# Install & build
npm install && npm install watson-react-components && npm run build

这是我在安装包的过程中得到的

│ └── whatwg-fetch@2.0.3 
└─┬ watson-react-components@0.6.16 
  ├── map-range@0.1.2 
  ├── numeral@2.0.6 
  ├─┬ prismjs@1.11.0 
  │ └─┬ clipboard@1.7.1 
  │   ├─┬ good-listener@1.2.2 
  │   │ └── delegate@3.2.0 
  │   ├── select@1.1.2 
  │   └── tiny-emitter@2.0.2 

这里是应用程序上的错误消息

 Failed to compile
 ./src/Conversation.js
 Module not found: Can't resolve 'watson-react-components' in   '/home/vcap/app/src'

【问题讨论】:

    标签: reactjs components ibm-cloud jsx watson


    【解决方案1】:

    错误在于安装应用程序的命令中。

    应该是npm install && npm install --save watson-react-components && npm run build

    你忘记了--save

    【讨论】:

      【解决方案2】:

      sorry sorry --- 问题出在电脑前。我错过了部署脚本中的 cf push 命令。 问题解决了!!!再次抱歉

      【讨论】:

        猜你喜欢
        • 2021-10-17
        • 1970-01-01
        • 2020-11-06
        • 1970-01-01
        • 2022-09-25
        • 2021-04-07
        • 2021-11-03
        • 1970-01-01
        • 2023-03-22
        相关资源
        最近更新 更多