我试图建立一个助焊器反应环境,我在这里观看了教程:https://egghead.io/lessons/react-development-environment-setup,我已经复制并粘贴了在教程vid中工作的确切代码(它可以在下面找到视频)但每次我运行它时都会出现以下错误:
Error: module "react" not found from "/flux/src/js/fake_179946b1.js"
at notFound (/flux/node_modules/gulp-browserify/node_modules/browserify/index.js:803:15)
at /flux/node_modules/gulp-browserify/node_modules/browserify/index.js:754:23
at /flux/node_modules/gulp-browserify/node_modules/browserify/node_modules/browser-resolve/index.js:185:24
at /flux/node_modules/gulp-browserify/node_modules/browserify/node_modules/resolve/lib/async.js:44:14
at process (/flux/node_modules/gulp-browserify/node_modules/browserify/node_modules/resolve/lib/async.js:113:43)
at /flux/node_modules/gulp-browserify/node_modules/browserify/node_modules/resolve/lib/async.js:122:21
at load (/flux/node_modules/gulp-browserify/node_modules/browserify/node_modules/resolve/lib/async.js:54:43)
at /flux/node_modules/gulp-browserify/node_modules/browserify/node_modules/resolve/lib/async.js:60:22
at /flux/node_modules/gulp-browserify/node_modules/browserify/node_modules/resolve/lib/async.js:16:47
at Object.oncomplete (fs.js:108:15)
我不明白,除了package.json文件之外,所有内容都被复制和粘贴,除了它有最新版本。这是它的副本:
{
"private": true,
"devDependencies": {
"gulp": "^3.8.8",
"gulp-browserify":"^0.5.0",
"gulp-concat":"^2.4.1",
"react":"^0.11.2",
"reactify":"^0.14.0",
"es6-promises":"^1.0.10",
}
}
出了什么问题?新版本中是否有重大变化,任何人都可能知道这些代码不再有效?除此之外,我不知道它可能是什么,因为它在视频教程中明显起作用
答案 0 :(得分:0)
如果您将sact / js / main.js文件中的React.renderComponent(...)方法更改为React.render(...),它可以正常工作。