Меню

Npm run eject выдает ошибку

I have try lot’s of things to solve this error.

Command:’npm run eject’

Remove untracked files, stash or commit any changes, and try again.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! devportalfrontend@0.1.0 eject: `react-scripts eject`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the devportalfrontend@0.1.0 eject script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/deep/.npm/_logs/2018-02-18T17_05_02_924Z-debug.log

How can help to solve this problem..

asked Feb 18, 2018 at 17:31

Mr Singh's user avatar

Mr SinghMr Singh

3,7064 gold badges38 silver badges57 bronze badges

I have tried this command it’s worked:

git add .
git commit -am "Save before ejecting"

and then try again.

answered Feb 19, 2018 at 15:10

Mr Singh's user avatar

Mr SinghMr Singh

3,7064 gold badges38 silver badges57 bronze badges

0

Uninstalling react-scripts and installing react-scripts-cssmodules solved the problem

npm uninstall react-scripts

And then

npm install react-scripts-cssmodules

then

 npm run eject

Add it the git changes

git add .
git commit -am "Save before ejecting"

answered May 16, 2018 at 5:28

Aravinth Raja's user avatar

You need to commit your changes before running eject:

git add .
git commit -am "change messages before running eject"

Now, Try

npm run eject

answered Mar 22, 2019 at 6:53

samrat shakya's user avatar

1

This says in the message that you have untracked files that means that they are not being monitored by your VCS. Hence add and commit them before you eject.

If you are using Visual Studio Code:

  • Just click on the third icon (Source Control), below the magnifying glass button
  • Then click on the tick mark, if it asks to automatically stage your changes Click Yes
  • Add your commit message and then you are done

enter image description here

Try ejecting again,

npm run eject

Should work just fine. Happy Hacking!

answered Nov 29, 2018 at 7:11

devDeejay's user avatar

devDeejaydevDeejay

5,3251 gold badge26 silver badges38 bronze badges

It is because you having the changed files

so initiate the new git repo

git init

then add all files to git

git add .

once added commit the files

git commit -am "Saving before ejecting"

now you can eject the project using below command

npm run eject

Happy Coding !!!!!!!

answered Feb 26, 2019 at 7:03

Boopathi kumar's user avatar

Boopathi kumarBoopathi kumar

3921 gold badge5 silver badges16 bronze badges

1

In my case, I found the solution here.

follow this may be it will helpful for you.

Step 1.

create-react-app yourProjectName

step 2.

cd yourProjectName

step 3.

npm uninstall react-scripts

step 4.

npm install react-scripts-cssmodules

step 5.

git init

step 6.

git add .

step 7.

git commit -am "ejecting"

step 8.

npm run eject

Zoe stands with Ukraine's user avatar

answered Mar 12, 2019 at 20:08

Mustak_Talukder's user avatar

2

just delete git file in the project and then run the command: npm run eject

in macos if you navigate to inside the project folder

CMD + SHIFT + .

this will show hidden files.

answered Jan 20, 2020 at 13:52

Yilmaz's user avatar

YilmazYilmaz

25.3k9 gold badges126 silver badges160 bronze badges

Check if any of the below tow options work for you :

  • Uninstalling and Re-installing the react-scripts-cssmodules :

    npm uninstall react-sctipts

    npm install react-scripts-cssmodules

    npm run eject

  • Committing the changes of the GIT repository :

    git add .

    git commit -am «Save before ejecting»

If any of the above two solutions do not work, and IF Git is not necessary for your current project, then go to

Control Panel -> Programs -> Select «Git«
and then UN-INSTALL.

Now run the «npm run eject» again.

It should work fine now.
You can go ahead and reinstall GIT again whenever necessary

answered Sep 12, 2018 at 10:18

naga's user avatar

Just make commit bc commit is necessary before leaving the project

PC MINGW64 ~/react/react2/myapp (master)
$ git commit -am "first commit for before ejecting"

and Then eject with this command

$ npm run eject

entpnerd's user avatar

entpnerd

9,6497 gold badges44 silver badges67 bronze badges

answered Jan 22, 2019 at 21:48

YASH THUMAR's user avatar

YASH THUMARYASH THUMAR

5,3491 gold badge5 silver badges4 bronze badges

1, git init and git add .
2, git commit -m ‘before eject’
3, yarn eject

  • List item

if that code not to solve problem, you can
1, npm uninstall react-scripts
2, npm install react-scripts-cssmodules
3, exec before code

answered Jan 11, 2022 at 4:08

Maugham's user avatar

1

As of today, the one that worked for me is
expo eject

answered Mar 30, 2022 at 18:43

Saran's user avatar

SaranSaran

6,2243 gold badges38 silver badges44 bronze badges

Скачал урок. Автор в терминале вводит выше указанную команду, и у него всё хорошо и никаких проблем. В итоге появляется папка config, а у меня вот это:

react-scripts eject

? Are you sure you want to eject? This action is permanent. Yes
This git repository has untracked files or uncommitted changes:

.idea/encodings.xml
D .idea/misc.xml
D .idea/modules.xml
D .idea/my-app.iml
M .idea/workspace.xml
M package-lock.json
M package.json
M public/index.html
src/App.css
M src/App.js
src/App.test.js
src/logo.svg
src/hoc/

Remove untracked files, stash or commit any changes, and try again.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! my-app@0.1.0 eject: `react-scripts eject`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the my-app@0.1.0 eject script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:UsersJoeAppDataRoamingnpm-cache_logs2019-03-09T18_32_13_689Z-debug.log

Тут ничего сложного. Я не понимаю что не так?


  • Вопрос задан

    более трёх лет назад

  • 1517 просмотров

У тебя git отслеживает изменение файлов.

Если хочешь сохранить изменения то либо их закоммить, либо сохрани в стеше вот что там написано

Так и быть я прочитаю за вас сообщение об ошибке

Remove untracked files, stash or commit any changes, and try again.

Могу и перевести что нужно сделать, но тут уж давайте попробуйте самостоятельно.

Пригласить эксперта

Необходимо прописать следующее
git add .
git commit -am «Save before ejecting»
npm run eject or yarn eject


  • Показать ещё
    Загружается…

29 янв. 2023, в 01:12

3000 руб./за проект

28 янв. 2023, в 22:48

500 руб./за проект

28 янв. 2023, в 20:58

30000 руб./за проект

Минуточку внимания

To solve the problem of NPM run eject error in react

Recently, I began to learn react. I used create react app to initialize a react project. Then I found that I wanted to configure webpack manually, but I didn’t know where it was. I found that I was using BD to configure webpack package.json There’s a bunch of code in the

 "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },

NPM run eject will copy all dependent files and corresponding dependencies ( webpack , Babel ) to your project. It's a single operation. Once eject , you can't go back. If you want to go back to the normal project, you have to Re NPM install create react app - G

It was found that the following error was reported when executing NPM run eject :

checked online, which means that the problem here is that the scaffold adds . Gitgnore files, but there is no local warehouse, which can be used normally according to the following order

git init
git add .
git commit -m 'init'

Then execute NPM run eject again, and the execution is successful.
after the execution is completed, it is found that package.json It's like this:

  "scripts": {
    "start": "node scripts/start.js",
    "build": "node scripts/build.js",
    "test": "node scripts/test.js"
  },

The last line of code was deleted by the system itself, not by me!

That's all for today

Reprint should be marked, thank you!

Read More:

  • webstorm npm install –save –save-exact –loglevel error react react-dom react-scripts has failed.
  • An error is reported when using react app rewired to start the react project
  • Perfectly solve the problem of NPM start error: cannot find module ‘XX’
  • NPM run build error solution
  • NPM run serve reported an error “NPM err! Missing script: start”
  • react Error: Unable to resolve module mobx-react
  • NPM run build failed to package err! Missing script: build
  • Failed to load plugin react: cannot find module ‘eslint plugin react’ appears when running Vue project‘
  • To solve the problem of failed to load: data in HTML5 game running rmmv locally/ actors.json problem
  • Solve the problem that the newly installed CodeBlocks cannot be compiled and run
  • [W xx:xx:xx.xxx NotebookApp] 404 GET/static/components/react/react-dom.production.min.js (::1)
  • 【react】 tsconfig.json Configuration of react JSX error reporting solution in
  • NPM run dev error: cannot find module ‘webpack cli / bin / config yargs‘
  • Error failed to compile with 1 errors after finding NPM run dev
  • npm run devstart error: Error: Unable to find module ‘semver’
  • Solve the problem of Python in Windows environment: Fatal error in launcher: Unable to create process using'”‘ in pip installation
  • After NPM run dev is running, the browser does not respond and reports an error in. / ~ / Babel loader / lib! / ~ / Vue loader / lib/ selector.js?type=script&in
  • How to solve the cross domain problem of Axios in Vue project
  • Solve the problem of using in tensoft 2. X tf.contrib.slim No module named appears in the package: tensorflow.contrib problem
  • Error: A cross-origin error was thrown. React doesn’t have access to the actual error object in deve

Description

When running npm run eject everything goes well up to the point where the code removes the node_modules folder where it fails on a random module.

Expected Behavior

The script runs without issues and displays a success message (or informs me in any way that everything went well.

Observed Behavior

Randomly while removing the process fails with the error message that a folder could not be removed because it is not empty. After that there is a line telling me that a directory was not found and then there is the usual npm error block:

Error running eject: Error: ENOTEMPTY: directory not empty, rmdir 'C:UsersUsernameReactNativeProjectNamenode_moduleslottie-react-nativesrcandroidbuildtmpexpandedArchivesclasses.jar_5gdp4bb5izj6gs3qq6f6ejit7comfacebookreact'
System cannot find the given directory (translated from German; might be inaccurate)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! ProjectName@0.1.0 eject: `react-native-scripts eject`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ProjectName@0.1.0 eject script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:UsersUsernameAppDataRoamingnpm-cache_logs2018-05-26T22_22_42_547Z-debug.log

I tried to get around this by using Ctrl+C to pause execution of the script, remove the folders in node_modules by hand and then continuing the process however that seemed to crash the script, no further output was printed and I was able to put in a new command (without yarn install for example was run).

Environment

Please run these commands in the project folder and fill in their results:

  • npm ls react-native-scripts:
ProjectName@0.1.0 C:UsersUsernameReactNativeProjectName
`-- (empty)
(1.14.0 is installed)

  • npm ls react-native:
ProjectName@0.1.0 C:UsersUsernameReactNativeProjectName
`-- UNMET DEPENDENCY react-native@0.51.1

npm ERR! missing: react-native@0.51.1, required by ProjectName@0.1.0
npm ERR! extraneous: react-native@0.51.1 C:UsersUsernameReactNativeProjectNamenode_modulesreact-native

(0.55.4 is installed)

  • npm ls expo:
ProjectName@0.1.0 C:UsersUsernameReactNativeProjectName
`-- UNMET DEPENDENCY expo@27.0.2

npm ERR! missing: expo@27.0.2, required by ProjectName@0.1.0

(27.0.1 is installed)

  • node -v: v8.9.1
  • npm -v: 6.0.0
  • yarn --version: 1.6.0
  • watchman version: 4.9.1

Also specify:

  1. Operating system: Windows 7 64-bit
  2. Phone/emulator/simulator & version: iPhone 5S, Galaxy S5

Reproducible Demo

Create a new project, change into the directory and eject
create-react-native-app TestingNodeModulesRemoval && cd TestingNodeModuleRemoval && npm run eject

However the issue can already be seen without ejecting by just trying to remove the node_modules folder with the command rmdir /S /Q node_modules. This is also described in this stackoverflow post and appears to be a windows issue. It would be great though if some kind of workaround could be implemented so this does not randomly happen.

Running the command from an administrator prompt did not solve the issue.

npm run eject

npm ERR! path C:UserssudarshanDesktopReactpackage.json
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open 'C:UserssudarshanDesktopReactpackage.json'
npm ERR! enoent This is related to npm not being able to find a file.       
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR!     C:UserssudarshanAppDataRoamingnpm-cache_logs2019-09-05T11_05_36_102Z-debug.log

ravibagul91's user avatar

ravibagul91

19.6k5 gold badges34 silver badges58 bronze badges

asked Sep 5, 2019 at 11:13

shubham donge's user avatar

2

Did you initialize the project with npm init?

answered Sep 5, 2019 at 11:27

scherera's user avatar

npm run eject

npm ERR! path C:UserssudarshanDesktopReactpackage.json
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open 'C:UserssudarshanDesktopReactpackage.json'
npm ERR! enoent This is related to npm not being able to find a file.       
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR!     C:UserssudarshanAppDataRoamingnpm-cache_logs2019-09-05T11_05_36_102Z-debug.log

ravibagul91's user avatar

ravibagul91

19.6k5 gold badges34 silver badges58 bronze badges

asked Sep 5, 2019 at 11:13

shubham donge's user avatar

2

Did you initialize the project with npm init?

answered Sep 5, 2019 at 11:27

scherera's user avatar

6 ответов

Я пробовал эту команду:

git add .
git commit -am "Save before ejecting"

а затем повторите попытку.

Mr Singh
19 фев. 2018, в 16:20

Поделиться

Удаление сценариев реакции и установка реакций-скриптов-cssmodules решили проблему

npm uninstall react-scripts

А потом

npm install react-scripts-cssmodules

затем

 npm run eject

Aravinth Raja
16 май 2018, в 06:35

Поделиться

Просто сделайте commit bc commit необходимо перед выходом из проекта

PC MINGW64 ~/react/react2/myapp (master)
$ git commit -am "first commit for before ejecting"

а затем вытолкнуть с помощью этой команды

$ npm run eject

YASH THUMAR
22 янв. 2019, в 23:27

Поделиться

@devDeejay это просто сработало, хотя может потребоваться некоторое время после записи «Enter» в сообщении коммита

Ratnabh kumar rai
06 дек. 2018, в 20:27

Поделиться

В сообщении говорится, что у вас есть необработанные файлы, что означает, что они не контролируются вашим VCS. Поэтому добавьте и зафиксируйте их перед тем, как вы выбросите.

Если вы используете код Visual Studio:

  • Просто нажмите на третий значок (Source Control), под кнопкой увеличительного стекла
  • Затем нажмите галочку, если она запросит автоматическое изменение ваших изменений. Нажмите «Да».
  • Добавьте сообщение о фиксации, а затем выполните

Изображение 149044

Попробуйте снова выталкивать,

npm run eject

Должно работать нормально. Счастливый взлом!

devDeejay
29 нояб. 2018, в 08:40

Поделиться

Проверьте, работает ли какой-либо из нижеперечисленных функций буксировки:

  • Деинсталляция и повторная установка сценариев-скриптов-css:

    npm удалять реакции-sctipts

    npm install react-scripts-cssmodules

    npm run eject

  • Выполнение изменений в репозитории GIT:

    git add.

    git commit -am «Сохранить до извлечения»

Если какое-либо из этих двух решений не работает, и IF Git не нужен для вашего текущего проекта, тогда перейдите к

Панель управления → Программы → Выберите «Git», а затем UN-INSTALL.

Теперь снова запустите » npm run eject «.

Теперь он должен работать нормально. Вы можете продолжить и снова установить GIT, когда это необходимо

naga
12 сен. 2018, в 11:41

Поделиться

Ещё вопросы

  • 1Как использовать константы jscience в Java?
  • 1Как получить все доступные методы для объекта в Pycharm (например, Pygame)
  • 0Странные ссылки на скрипты в моем htmls
  • 0Как сохранить Легенду с FLOT-диаграммой
  • 0Codeigniter iOS сессий веб-приложений не сохраняется
  • 1Как включить методы PUT и DELETE HTTP, выполняющие Nancy в xsp4 на Mono?
  • 1Расшифровка AES: javax.crypto.IllegalBlockSizeException: последний блок не завершен при расшифровке
  • 1Тестирование активности потока с роботом
  • 0Экспорт в PDF не работает для второй формы в YII
  • 1Непрокидываемый код в java производительности try / catch
  • 0Создать комбинацию пары из массива (abc -> ab: bc: ca или ac: ba: cb)
  • 0ПОЛНЫЙ ТЕКСТОВЫЙ индекс на Liquibase / MariaDB или Mysql
  • 0перенаправление на страницу благодарности после отправки сообщения через контактную форму — php
  • 0Совместное использование состояния проверки для нескольких полей с одним и тем же средством проверки
  • 0Какой лучший способ убрать href из фрагмента HTML-кода?
  • 0Ошибка вывода назначения pthread
  • 0Предотвращение двойной записи в MySQL (например, когда запрос на вставку вызывается многократно)
  • 1Модель долго тренируется
  • 0Используйте параметр IN в предложении WHERE внутри хранимой процедуры MySQL
  • 1Можно ли вызвать метод из наручных часов и смонтировать?
  • 1Доступ к данным из HttpListener в WinForms, как мы делаем с ASP .NET (Запрос [«Ключ»])
  • 0Динамически изменять jQuery «зависания», проверяя cookie
  • 0Расположите div слева: 0 окна (не родительский)
  • 0Сортировка и разбиение по страницам столбцов в HTML-таблице с JQuery не работает
  • 1Реагируй родной — вставляй Twitter
  • 1Где восстановить состояние экземпляра?
  • 0Mysql для хранения текста?
  • 0HTML — сделать так, чтобы указатель мыши над div влиял на несколько div?
  • 0Количество запросов с диапазоном
  • 0Отображение таблицы в таблице по клику
  • 0Ошибка сегментации по размеру вектора
  • 1Сортировать массив на основе времени и группы
  • 0динамическое количество потоков в C ++
  • 0Подтвержденная форма JQuery не отправляется
  • 0Странное поведение при оценке оператора if [duplicate]
  • 1Мне нужно отредактировать текстовый файл с непостоянной структурой. Попытка использовать панд, это лучший инструмент для работы?
  • 1Ионная структура инициализирует значения перед загрузкой страницы
  • 1Невозможно разделить изображение с помощью Python
  • 1какой метод подходит для переопределения растрового изображения?
  • 1Добавьте метки легенды для каждого значения Y ASP.NET/C#
  • 0MySQL — подзапрос / JOIN той же таблицы различных элементов ревизии
  • 0Преобразование из пользовательского класса в std :: string
  • 1PongWebSocketFrame не поддерживается Internet Explorer
  • 0Пользовательский неупорядоченный набор хэш-функции
  • 0JQuery. Переместить дочерние данные добавления
  • 1Общий способ перезаписи одного типа поля в типе объекта потока
  • 1Объединение / Пересечение двух наборов без изменения одного из наборов
  • 1log4j — ОШИБКА, лог DEBUG?
  • 1Изменение действий во вкладке
  • 0Получить количество истинных / ложных значений в массиве, используя JavaScript

Hey, Guys here is the solution to the problem commonly faced by many of React Native developers nowadays that is the problem in ejecting the React Native Project after the React Native version 0.57 launch.

The problem happens when we create a project using create-react-native-app and try to eject the project using npm run eject. It shows the error: cannot find symbol

and error: MainActivity is not abstract and does not override abstract method getPackages() in ReactActivity

Solution

To solve this problem we have you have to make some changes to your project and the changes are as following:

Step 1: 

replace in package.json

"react-native": "https://github.com/expo/react-native/archive/sdk-30.0.0.tar.gz"

to

"react-native": "~0.55.2"

Step 2:

Make an index.js file in your project directory

Add the following code in index.js

import { AppRegistry } from "react-native";
import App from "./App";
AppRegistry.registerComponent("projectname", () => App);

Step 3:

Now remove the node module folder and install again using

sudo npm install

Step 4:

That is enough to solve the problem now you can run your project again using

react-native run-android

If you have any doubts or you want to share something about the topic you can comment below or contact us here. There will be more posts coming soon. Stay tuned!

Hope you liked it. 🙂

0 0 голоса
Рейтинг статьи
Подписаться
Уведомить о
guest

0 комментариев
Старые
Новые Популярные
Межтекстовые Отзывы
Посмотреть все комментарии

А вот еще интересные материалы:

  • Яшка сломя голову остановился исправьте ошибки
  • Ясность цели позволяет целеустремленно добиваться намеченного исправьте ошибки
  • Ясность цели позволяет целеустремленно добиваться намеченного где ошибка
  • Not configured to listen on any interfaces dhcp ошибка
  • Not another pdf scanner 2 ошибка драйвера сканирования