我是React-native的新手,想在React-native中作为客户端,Node作为服务器和MongoDB执行CRUD操作。现在,我想当我从服务器文件夹运行server.js时,它应该同时运行node和react-native。 我已经在package.json(服务器端)中完成了此操作
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start":"node index.js",
"server":"nodemon index.js",
"client":"npm run start --prefix client"
},
但是,给出这个输出是行不通的
> server@1.0.0 client /root/Desktop/node
> npm run start --prefix client
> client@0.0.1 start /root/Desktop/node/client
> node node_modules/react-native/local-cli/cli.js start
┌──────────────────────────────────────────────────────────────────────────────┐
│ │
│ Running Metro Bundler on port 8081. │
│ │
│ Keep Metro running while developing on any JS projects. Feel free to │
│ close this tab and run your own Metro instance if you prefer. │
│ │
│ https://github.com/facebook/react-native │
│ │
└──────────────────────────────────────────────────────────────────────────────┘
Looking for JS files in
/root/Desktop/node/client
Loading dependency graph, done.
使用此选项是因为在客户端package.json中
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
}
找不到任何可以帮助我的东西。预先感谢。