每当我使用create-react-native-app启动一个项目并命令yarn启动时,都会出现以下错误:
error Command "start" not found.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
在此之前,当我命令 create-react-native-app 时,过程结束:
(node:7192) UnhandledPromiseRejectionWarning: Error: Cannot find module 'C:\Users\DELL PC\Desktop\Coursera WebDev\ReactNative\confusionAgain\node_modules\react-native-scripts\build\scripts\init.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at _callee2$ (C:\Users\DELL PC\AppData\Roaming\npm\node_modules\create-react-native-app\build\index.js:128:32)
at tryCatch (C:\Users\DELL PC\AppData\Roaming\npm\node_modules\create-react-native-app\node_modules\regenerator-runtime\runtime.js:62:40)
at Generator.invoke [as _invoke] (C:\Users\DELL PC\AppData\Roaming\npm\node_modules\create-react-native-app\node_modules\regenerator-runtime\runtime.js:296:22)
at Generator.prototype.(anonymous function) [as next] (C:\Users\DELL PC\AppData\Roaming\npm\node_modules\create-react-native-app\node_modules\regenerator-runtime\runtime.js:114:21)
at step (C:\Users\DELL PC\AppData\Roaming\npm\node_modules\create-react-native-app\node_modules\babel-runtime\helpers\asyncToGenerator.js:17:30)
at C:\Users\DELL PC\AppData\Roaming\npm\node_modules\create-react-native-app\node_modules\babel-runtime\helpers\asyncToGenerator.js:28:13
(node:7192) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:7192) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
我尝试过的方法:
{
"name": "confusion",
"version": "0.1.0",
"private": true,
"devDependencies": {
"react-native-scripts": "2.0.1"
}
}
对此:
{
"name": "confusion",
"version": "0.1.0",
"private": true,
"devDependencies": {
"react-native-scripts": "2.0.1"
},
"dependencies": {
"react": "^15.4.2",
"react-dom": "^15.4.2",
"react-scripts": "^3.4.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
}
}
,然后命令npm start或yarn start,但是它说缺少索引文件。 请帮助,请。