【发布时间】:2018-09-23 06:30:53
【问题描述】:
我用(我的操作系统:Windows 10)创建了一个示例项目;
expo init test
cd test
npm start
一切正常,我可以在手机上看到我的应用程序和 package.json 的外观;
{
"name": "empty-project-template",
"main": "node_modules/expo/AppEntry.js",
"private": true,
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"eject": "expo eject"
},
"dependencies": {
"expo": "^30.0.1",
"react": "16.3.1",
"react-native": "https://github.com/expo/react-native/archive/sdk-30.0.0.tar.gz",
}
}
但如果我想安装像“uuid”这样的包;
npm install uuid
安装包没有问题,然后我写了;
npm start
This command requires Expo CLI.
Do you want to install it globally [Y/n]?
我按“Y”,但它给出了错误;
This command requires Expo CLI.
Do you want to install it globally [Y/n]? y
Installing the package 'expo-cli'...
events.js:183
throw er; // Unhandled 'error' event
^
Error: spawn npm ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:190:19)
at onErrorNT (internal/child_process.js:362:16)
at _combinedTickCallback (internal/process/next_tick.js:139:11)
at process._tickCallback (internal/process/next_tick.js:181:9)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! empty-project-template@ start: `expo start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the empty-project-template@ start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
包名不重要,如果我安装任何包并运行npm start,我的项目已关闭,我无法使用我的项目,我用yarn测试了这一步,它和npm一样,我的错了?
【问题讨论】: