我创建了一个示例项目(我的操作系统:Windows 10);
expo init test
cd test
npm start
Run Code Online (Sandbox Code Playgroud)
一切运作良好,我可以在手机上看到我的应用程序和我的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",
}
}
Run Code Online (Sandbox Code Playgroud)
但是,如果我想安装像"uuid"这样的软件包;
npm install uuid
Run Code Online (Sandbox Code Playgroud)
包安装没有问题,然后我写;
npm start
This command requires Expo CLI.
Do you want to install it globally [Y/n]?
Run Code Online (Sandbox Code Playgroud)
我按'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.
Run Code Online (Sandbox Code Playgroud)
包名称并不重要,如果我安装任何包并运行npm start,我的项目已关闭,我无法使用我的项目,我测试了这一步yarn,同样的npm,我的错误是什么?