gpt4 book ai didi

node.js - npm 安装后 npm 启动失败

转载 作者:搜寻专家 更新时间:2023-10-31 23:29:18 25 4
gpt4 key购买 nike

我用(我的操作系统: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 一样,我的错误是什么?

最佳答案

对于那些为这个问题而苦苦挣扎的人,

  1. 导航到代码库的 node_modules > .bin
  2. 在该目录中找到 expo 和 expo.cmd
  3. 将其重命名为任何名称。

您可以开始了。

关于node.js - npm 安装后 npm 启动失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52463614/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com