未捕获的ReferenceError:进程未定义react-bootstrap

时间:2017-11-29 07:50:51

标签: javascript node.js reactjs spring-boot npm

我试图将react-bootstrap js文件包含在我的项目中几个小时。我是新手做出反应,我只会将它用于客户端。我试图从CDN中包含,但无法使其工作(React-Bootsrap Uncaught ReferenceError: require is not defined

这次我通过npm下载了包,然后在我的spring启动项目中复制了整个node_modules文件夹。我试图包含如下文件,并没有写任何其他代码,仅包括在内。

<script src="${pageContext.request.contextPath}/node_modules/react/cjs/react.development.js"></script>
<script src="${pageContext.request.contextPath}/node_modules/react-dom/cjs/react-dom.development.js"></script>
<script src="${pageContext.request.contextPath}/node_modules/react-bootstrap/dist/react-bootstrap.js"></script>

但是我收到以下错误:

react.development.js:14 Uncaught ReferenceError: process is not defined
at react.development.js:14
(anonymous) @ react.development.js:14
react-dom.development.js:14 Uncaught ReferenceError: process is not defined
at react-dom.development.js:14
(anonymous) @ react-dom.development.js:14
 react-bootstrap.js:2218 Uncaught TypeError: Cannot read property 'Component' of undefined
at Object.exports.__esModule (react-bootstrap.js:2218)
at __webpack_require__ (react-bootstrap.js:30)
at Object.exports.__esModule (react-bootstrap.js:450)
at __webpack_require__ (react-bootstrap.js:30)
at Object.exports.__esModule (react-bootstrap.js:62)
at __webpack_require__ (react-bootstrap.js:30)
at exports.__esModule (react-bootstrap.js:50)
at react-bootstrap.js:53
at webpackUniversalModuleDefinition (react-bootstrap.js:9)
at react-bootstrap.js:10
exports.__esModule @ react-bootstrap.js:2218
__webpack_require__ @ react-bootstrap.js:30
 exports.__esModule @ react-bootstrap.js:450
__webpack_require__ @ react-bootstrap.js:30
exports.__esModule @ react-bootstrap.js:62
__webpack_require__ @ react-bootstrap.js:30
exports.__esModule @ react-bootstrap.js:50
(anonymous) @ react-bootstrap.js:53
webpackUniversalModuleDefinition @ react-bootstrap.js:9
(anonymous) @ react-bootstrap.js:10
1:85 Uncaught ReferenceError: ReactBootstrap is not defined
at 1:85

0 个答案:

没有答案