折腾:
【已解决】ReactNative中实现底部Tab页面和顶部导航栏
期间,npm start突然出错:
➜ rn_rse npm start > [email protected] start /Users/crifan/dev/dev_root/daryun/Projects/xxx/sourcecode/react_native/rn_rse/rn_rse > react-native-scripts start sh: react-native-scripts: command not found npm ERR! file sh npm ERR! code ELIFECYCLE npm ERR! errno ENOENT npm ERR! syscall spawn npm ERR! [email protected] start: `react-native-scripts start` npm ERR! spawn ENOENT npm ERR! npm ERR! Failed at the [email protected] 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/crifan/.npm/_logs/2017-10-09T09_08_38_204Z-debug.log |
而刚才还好好的。
难道是安装了:npm install –save react-navigation
就导致此处脚本出错了???
难道此处新增加了几个js文件,就不行了?
去搜:
react-native-scripts: command not found
Unable to run playground example · Issue #1708 · react-community/react-navigation
重新去试试:
npm install
➜ rn_rse npm install npm WARN deprecated [email protected]: connect 2.x series is deprecated npm WARN [email protected] requires a peer of react@* but none was installed. npm WARN [email protected] requires a peer of react-native@* but none was installed. npm WARN [email protected] requires a peer of react-native@* but none was installed. npm WARN [email protected] requires a peer of react@* but none was installed. npm WARN [email protected] requires a peer of react-native@* but none was installed. npm WARN [email protected] requires a peer of react@* but none was installed. npm WARN [email protected] requires a peer of react-native@* but none was installed. npm WARN [email protected] requires a peer of react-native@* but none was installed. npm WARN [email protected] requires a peer of react@^16.0.0-alpha.12 but none was installed. npm WARN [email protected] requires a peer of react@^0.14.0 || ^15.0.0-0 || ^16.0.0-0 but none was installed. added 579 packages, removed 31 packages and updated 37 packages in 50.741s |
然后安装了500多个包,感觉很诡异啊。。。
结果npm start虽然可以运行,但是最后还是出错:
➜ rn_rse npm start > [email protected] start /Users/crifan/dev/dev_root/daryun/Projects/xxx/sourcecode/react_native/rn_rse/rn_rse > react-native-scripts start 17:16:38: Starting packager… ***ERROR STARTING PACKAGER*** Error: You are using npm version 5.0.0. We recommend version 4.6.1. To install it, run ‘npm i -g [email protected]’. ***ERROR STARTING PACKAGER*** Warning: Problem validating fields in app.json. See https://docs.expo.io/versions/v21.0.0/guides/configuration.html. • ‘slug’ should match pattern “^[a-zA-Z0-9\-]+$”. Error: React native is not installed. Please run `npm install` in your project directory. 17:16:41: Error starting packager: Error: Couldn’t start project. Please fix the errors and restart the project. at /xdl/src/Project.js:1217:11 at Generator.next (<anonymous>) at step (/Users/crifan/dev/dev_root/daryun/Projects/xxx/rn_rse/rn_rse/node_modules/xdl/build/Project.js:1505:191) at /Users/crifan/dev/dev_root/daryun/Projects/xxxe/node_modules/xdl/build/Project.js:1505:361 at <anonymous> npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! [email protected] start: `react-native-scripts start` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the [email protected] 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/crifan/.npm/_logs/2017-10-09T09_16_41_502Z-debug.log |
一堆的error,算了,还是先去解决:
【总结】
最终是:
先去把npm按照提示,换到4.6.1:
sudo npm i -g [email protected]
后,
npm install
npm start
就消除了此问题了。
转载请注明:在路上 » 【已解决】npm start出错:react-native-scripts: command not found