Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

npm start fails after npm install

Tags:

node.js

npm

expo

i create a sample project with (my os : Windows 10 ) ;

expo init test
cd test
npm start

everything works well and i can see my app on phone and my package.json looks ;

{
  "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",
  }
}

But if i want to install a package like "uuid" ;

npm install uuid

package is installed without problems , then i wrote ;

   npm start

This command requires Expo CLI.
Do you want to install it globally [Y/n]?

i press 'Y' , but it gives that errors ;

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.

Package name is not important , if i install any package and run npm start , my project is down and i cant use my project, i tested this step with yarn , its same like npm , what is my mistake ?

like image 266
redkont Avatar asked Dec 11 '22 05:12

redkont


2 Answers

For those struggling with this issue,

  1. Navigate to node_modules > .bin of the codebase
  2. Find expo and expo.cmd in that directory
  3. Rename it to anything.

You are good to go.

like image 127
zevy_boy Avatar answered Dec 28 '22 08:12

zevy_boy


For me, run expo start directly will work. Seems like npm does not know yet the existent of expo-cli

like image 44
hakuna1811 Avatar answered Dec 28 '22 06:12

hakuna1811