React JS无法使用npm start或yarn start运行

时间:2020-05-10 17:53:18

标签: reactjs npm yarnpkg

我尝试使用import Cards, { Card } from 'react-swipe-card' const data = ['Alexandre', 'Thomas', 'Lucien'] const Wrapper = () => { return ( <Cards onEnd={action('end')} className='master-root'> {data.map(item => <Card onSwipeLeft={action('swipe left')} onSwipeRight={action('swipe right')}> <h2>{item}</h2> </Card> )} </Cards> ) } 运行我的react项目,但是它总是显示这样的错误

yarn start

我也尝试使用events.js:298 throw er; // Unhandled 'error' event ^ Error: spawn cmd ENOENT at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19) at onErrorNT (internal/child_process.js:467:16) at processTicksAndRejections (internal/process/task_queues.js:84:21) Emitted 'error' event on ChildProcess instance at: at Process.ChildProcess._handle.onexit (internal/child_process.js:273:12) at onErrorNT (internal/child_process.js:467:16) at processTicksAndRejections (internal/process/task_queues.js:84:21) { errno: -4058, code: 'ENOENT', syscall: 'spawn cmd', path: 'cmd', spawnargs: [ '/s', '/c', 'start', '""', '/b', '"http://localhost:3000"' ] } error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. 运行,但仍然显示这样的错误

npm start

即使我使用events.js:298 throw er; // Unhandled 'error' event ^ Error: spawn cmd ENOENT at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19) at onErrorNT (internal/child_process.js:467:16) at processTicksAndRejections (internal/process/task_queues.js:84:21) Emitted 'error' event on ChildProcess instance at: at Process.ChildProcess._handle.onexit (internal/child_process.js:273:12) at onErrorNT (internal/child_process.js:467:16) at processTicksAndRejections (internal/process/task_queues.js:84:21) { errno: -4058, code: 'ENOENT', syscall: 'spawn cmd', path: 'cmd', spawnargs: [ '/s', '/c', 'start', '""', '/b', '"http://localhost:3000"' ] } npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! myreactweb@0.1.0 start: `react-scripts start` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the myreactweb@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! C:\Users\jamal\AppData\Roaming\npm-cache\_logs\2020-05-10T17_47_44_268Z-debug.log 创建新项目然后再次启动该项目,仍然会出现相同的结果。

对这个问题有什么解决办法吗?

0 个答案:

没有答案