我使用create-react-app创建了一个样例react应用,但是npm start失败了。
我尝试过使用node 11.4和10.4(npm 6.4.1)。
npm install create-react-app -g
create-react-app t2
cd t2
npm start
期望
能够启动简单的React服务器,并在浏览器上通过localhost:3000进行访问。
实际情况
服务器未能启动,我在终端中看到了以下信息:
$ npm start
> t2@0.1.0 start /Users/samr/dev/githubs/react/t2
> react-scripts start
/Users/samr/dev/githubs/react/t2/node_modules/ajv/lib/keyword.js:65
throw new Error('custom keyword definition is invalid: ' + this.errorsText(validateDefinition.errors));
^
Error: custom keyword definition is invalid: data.errors should be boolean
at Ajv.addKeyword (/Users/samr/dev/githubs/react/t2/node_modules/ajv/lib/keyword.js:65:13)
at module.exports (/Users/samr/dev/githubs/react/t2/node_modules/ajv-errors/index.js:10:7)
at Object.<anonymous> (/Users/samr/dev/githubs/react/t2/node_modules/schema-utils/src/validateOptions.js:22:1)
at Module._compile (internal/modules/cjs/loader.js:723:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:734:10)
at Module.load (internal/modules/cjs/loader.js:620:32)
at tryModuleLoad (internal/modules/cjs/loader.js:560:12)
at Function.Module._load (internal/modules/cjs/loader.js:552:3)
at Module.require (internal/modules/cjs/loader.js:659:17)
at require (internal/modules/cjs/helpers.js:22:18)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! t2@0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the t2@0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/samr/.npm/_logs/2019-02-09T23_19_40_848Z-debug.log