深入react技术栈-源码问题1
来源:互联网 发布:位图转矢量图软件 编辑:程序博客网 时间:2024/06/14 21:27
问题1 深入react技术栈源码第一次运行时报错--'NODE_ENV' 不是内部或外部命令,也不是可运行的程序或批处理文件。
在运行第二章的代码时,执行npm install
后运行代码时,报 ‘NODE_ENV’ 不是内部或外部命令,也不是可运行的程序或批处理文件。
解决方法
找到 package.json
文件 修改scripts
其中的内容:
"scripts": { "start": "set NODE_ENV=dev && node ./server.js"},
问题2
ERROR in ./js/Tabs.jsModule build failed: SyntaxError: F:/react/react-book-examples-master/02/js/Tabs.js: Decorators are not officially supported yet in 6.x pending a proposal update.However, if you need to use them you can install the legacy decorators transform with:npm install babel-plugin-transform-decorators-legacy --save-devand add the following line to your .babelrc file:{ "plugins": ["transform-decorators-legacy"]}The repo url is: https://github.com/loganfsmyth/babel-plugin-transform-decorators-legacy.
解决方法
这个问题是babel的版本问题,在高版本的babel中阻止实施装饰,需要我们添加一个特殊的插件 babel-plugin-transform-decorators-legacy
npm i --save-dev babel-plugin-transform-decorators-legacy
然后修改 .babelrc
{ "presets": ["es2015", "stage-0", "react"], "plugins": [ ["transform-decorators-legacy"], // ... ]}
或者 Webpack
{ test: /\.jsx?$/, loader: 'babel', query: { cacheDirectory: true, plugins: ['transform-decorators-legacy' ], presets: ['es2015', 'stage-0', 'react'] }}
参考链接
Webpack babel 6 ES6装饰
React.js 6.x正在等待提案更新中还不支持装饰器
by web开发者 from http://weber.pub/
本文地址: http://weber.pub/深入react技术栈-源码问题1/353.html
0 0
- 深入react技术栈-源码问题1
- 从 Antd 《深入React技术栈》里面总结不了解的
- [深入剖析React Native]React Native组件之Touchable*源码解析(1)
- react native 技术栈
- React技术栈
- React技术栈
- React技术栈
- React Native Android入门实战及深入源码分析系列(1)——Hello world
- React技术栈之为什么选择react
- React学习 -- React源码(1)
- React实战-深入源码了解Redux用法之Connect
- React实战-深入源码了解Redux用法之Provider
- React实战-深入源码了解Redux用法之Reducers
- React实战-深入源码了解Redux用法之Middleware
- React深入源码--了解Redux用法之Provider
- React技术栈探究-Redux
- React源码分析1 -- 框架
- React Native Android入门实战及深入源码分析系列(2)——React Native源码编译
- java 集合框架总结
- 忙碌的一天
- git常用命令
- 【CONCAT】使用之MySQL官方文档翻译
- 聚合数据(问答机器人)
- 深入react技术栈-源码问题1
- bzoj2226 LCMSum
- 数据类型
- spring_1-4,IOC&DI概述_配置 Bean_属性配置细节
- 洛谷 P1090 合并果子
- 【Adreno Profiler】Adreno Profiler & SnapDragon profiler 的安装和使用
- 代码审查中Handler会影响性能
- Ubuntu redis安装与使用
- POJ 1061 同余方程