telegram-react icon indicating copy to clipboard operation
telegram-react copied to clipboard

Ошибка при восстановлении зависимостей

Open Alien-hide opened this issue 4 years ago • 10 comments

Первый раз работаю с node js При попытке вызвать из корня, скопированного репозитория, npm install Получаю ошибку:

npm WARN tar ENOENT: no such file or directory, open '/opt/telegram-react-master/node_modules/.staging/yallist-0a8a5093/package.json' npm WARN tar ENOENT: no such file or directory, open '/opt/telegram-react-master/node_modules/.staging/webpack-dev-server-373b6925/package.json' npm WARN tar ENOENT: no such file or directory, open '/opt/telegram-react-master/node_modules/.staging/execa-9d05926e/package.json' npm WARN tar ENOENT: no such file or directory, open '/opt/telegram-react-master/node_modules/.staging/yallist-0a8a5093/README.md' npm WARN tar ENOENT: no such file or directory, open '/opt/telegram-react-master/node_modules/.staging/webpack-dev-server-373b6925/CHANGELOG.md' npm WARN tar ENOENT: no such file or directory, open '/opt/telegram-react-master/node_modules/.staging/execa-9d05926e/index.js' npm WARN tar ENOENT: no such file or directory, open '/opt/telegram-react-master/node_modules/.staging/yallist-0a8a5093/LICENSE' npm WARN tar ENOENT: no such file or directory, open '/opt/telegram-react-master/node_modules/.staging/webpack-dev-server-373b6925/LICENSE' npm WARN tar ENOENT: no such file or directory, open '/opt/telegram-react-master/node_modules/.staging/yallist-0a8a5093/iterator.js' npm WARN tar ENOENT: no such file or directory, open '/opt/telegram-react-master/node_modules/.staging/webpack-dev-server-373b6925/README.md' npm WARN tar ENOENT: no such file or directory, open '/opt/telegram-react-master/node_modules/.staging/@babel/runtime-46e2b43a/LICENSE' npm WARN tar ENOENT: no such file or directory, open '/opt/telegram-react-master/node_modules/.staging/yallist-0a8a5093/yallist.js' npm WARN tar ENOENT: no such file or directory, open '/opt/telegram-react-master/node_modules/.staging/@babel/runtime-46e2b43a/README.md' npm WARN tar ENOENT: no such file or directory, open '/opt/telegram-react-master/node_modules/.staging/react-router-dom-deccc8fa/umd/react-router-dom.min.js' npm WARN tar ENOENT: no such file or directory, open '/opt/telegram-react-master/node_modules/.staging/emoji-mart-bc9fbe29/data/apple.json' npm WARN tar ENOENT: no such file or directory, open '/opt/telegram-react-master/node_modules/.staging/lottie-web-46017fee/build/player/lottie_canvas.min.js' npm WARN tar ENOENT: no such file or directory, open '/opt/telegram-react-master/node_modules/.staging/libphonenumber-js-837d0a1a/metadata.min.json' npm WARN tar ENOENT: no such file or directory, open '/opt/telegram-react-master/node_modules/.staging/react-dom-9577a55d/cjs/react-dom-unstable-fire.production.min.js' npm WARN tar ENOENT: no such file or directory, open '/opt/telegram-react-master/node_modules/.staging/prettier-c4b6c290/index.js' npm WARN tar ENOENT: no such file or directory, open '/opt/telegram-react-master/node_modules/.staging/lodash-0e73f158/lodash.min.js' npm WARN tar ENOENT: no such file or directory, open '/opt/telegram-react-master/node_modules/.staging/lodash-98face60/lodash.min.js' npm WARN tar ENOENT: no such file or directory, open '/opt/telegram-react-master/node_modules/.staging/lodash-eb16d848/lodash.min.js' npm WARN tar ENOENT: no such file or directory, open '/opt/telegram-react-master/node_modules/.staging/lodash-f3bae6f6/lodash.min.js' npm WARN tar ENOENT: no such file or directory, open '/opt/telegram-react-master/node_modules/.staging/lodash-321ef208/lodash.min.js' npm WARN tar ENOENT: no such file or directory, open '/opt/telegram-react-master/node_modules/.staging/lodash-39260369/lodash.min.js' npm WARN tar ENOENT: no such file or directory, open '/opt/telegram-react-master/node_modules/.staging/lodash-d51ebb7e/lodash.min.js' npm WARN tar ENOENT: no such file or directory, open '/opt/telegram-react-master/node_modules/.staging/lodash-6c2be400/lodash.min.js' npm WARN tar ENOENT: no such file or directory, open '/opt/telegram-react-master/node_modules/.staging/lodash-f1b494f5/lodash.min.js' npm ERR! code E404 npm ERR! 404 Not Found - GET https://registry.npmjs.org/@arseny30/tdweb/-/tdweb-1.4.6.tgz npm ERR! 404 npm ERR! 404 '@arseny30/[email protected]' is not in the npm registry. npm ERR! 404 You should bug the author to publish it (or use the name yourself!) npm ERR! 404 It was specified as a dependency of 'telegram-react-master' npm ERR! 404 npm ERR! 404 Note that you can also install from a npm ERR! 404 tarball, folder, http url, or git url.

npm ERR! A complete log of this run can be found in: npm ERR! /root/.npm/_logs/2019-08-26T06_57_53_406Z-debug.log

Если помогут могу отправить логи указанные в конце сообщения.

Alien-hide avatar Aug 26 '19 07:08 Alien-hide

Please replace "@arseny30/tdweb": "1.4.6" with "tdweb": "1.4.3" at package.json

evgeny-nadymov avatar Aug 26 '19 23:08 evgeny-nadymov

Thanks it help, but when i start service they crash with message:

0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'run', 'start' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle [email protected]~prestart: [email protected]
6 info lifecycle [email protected]~start: [email protected]
7 verbose lifecycle [email protected]~start: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~start: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/opt/telegram-react-master/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
9 verbose lifecycle [email protected]~start: CWD: /opt/telegram-react-master
10 silly lifecycle [email protected]~start: Args: [ '-c', 'react-scripts start' ]
11 silly lifecycle [email protected]~start: Returned: code: 1  signal: null
12 info lifecycle [email protected]~start: Failed to exec start script
13 verbose stack Error: [email protected] start: `react-scripts start`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:326:16)
13 verbose stack     at EventEmitter.emit (events.js:209:13)
13 verbose stack     at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:209:13)
13 verbose stack     at maybeClose (internal/child_process.js:1021:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
14 verbose pkgid [email protected]
15 verbose cwd /opt/telegram-react-master
16 verbose Linux 3.10.0-957.21.3.el7.x86_64
17 verbose argv "/usr/bin/node" "/usr/bin/npm" "run" "start"
18 verbose node v12.9.0
19 verbose npm  v6.10.2
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] start: `react-scripts start`
22 error Exit status 1
23 error Failed at the [email protected] start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

Alien-hide avatar Aug 27 '19 05:08 Alien-hide

Recheck also that you manually copy tdweb files with command cp node_modules/tdweb/dist/* public/

evgeny-nadymov avatar Aug 27 '19 10:08 evgeny-nadymov

Double check but not work.

Browserslist: caniuse-lite is outdated. Please run next command `npm update`
The build failed because the process exited too early. This probably means the system ran out of memory or someone called `kill -9` on the process.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `react-scripts start`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] start 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!     /root/.npm/_logs/2019-08-27T10_54_47_846Z-debug.log
[root@vpn telegram-react-master]#

Alien-hide avatar Aug 27 '19 10:08 Alien-hide

The following patch fixed the issue for me, as @evgeny-nadymov advised

diff --git a/package.json b/package.json
index 6d760e7..e2dbb71 100644
--- a/package.json
+++ b/package.json
@@ -4,7 +4,7 @@
   "version": "0.0.398",
   "private": true,
   "dependencies": {
-    "@arseny30/tdweb": "1.4.6",
+    "tdweb": "1.4.3",
     "@material-ui/core": "^3.9.2",
     "@material-ui/icons": "^3.0.2",
     "@material-ui/lab": "^3.0.0-alpha.30",

karawitan avatar Aug 27 '19 16:08 karawitan

After "npm run start" (and wait a few minutes), I finally get:

Failed to compile.

./src/Controllers/TdLibController.js
Module not found: Can't resolve '@arseny30/tdweb/dist/tdweb' in '/home/kalou/telegram-react/src/Controllers'

I've fixed the issue by doing the following:

    replaced "@arseny30/tdweb" to "tdweb" at src/Controllers/TdLibController.js
    replaced "@arseny30/tdweb" to "tdweb" at public/custom-service-worker.js

I may open a PR if you need, already commited to my own local branch.

karawitan avatar Aug 27 '19 16:08 karawitan

тоже самое @arseny30 нету

dmitryshelomanov avatar Jan 02 '20 22:01 dmitryshelomanov

/cc @userbq201 @Alien-hide

Вообще в репозитории package.json какой-то битый. Я думаю автор его давным давно не обновлял руками и констрейнты давно устарели. Короче даже если вы заставите его компилироваться, у вас не будут работать стикеры, смена языка и настройки. Потому что обновился React или какой-то другой пакет и всё стало несовместимо с этой кодовой базой.

Я нашёл только одно решение:

  1. Не выпиливайте package-lock.json, ибо там как раз все те зависимости, что автор юзает в реале.
  2. Попробуйте команду npm ci, она нужна для CI/CD систем, но для нас то что нужно: она игнорирует файл package.json и ставит зависимости, которые указаны именно в package-lock.json. При таком раскладе у меня всё прекрасно собирается, стикеры работают, языки меняются.

Автору советую обновить package.json в соответствии.

Short note for English users:

  1. Use deps from package-lock.json, not from package.json -- it's broken.
  2. npm ci command should help you to download the exact deps as package-lock.json describes.

savely-krasovsky avatar Jan 03 '20 09:01 savely-krasovsky

@L11R У меня почему-то даже npm ci тоже не работает Пишет:

npm ERR! code ETARGET
npm ERR! notarget No matching version found for [email protected].
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.

islomkhodja avatar Feb 18 '20 10:02 islomkhodja

@Islomkhodja потому что такой версии нет. Поправь package.json и попробуй ещё раз. Версию возьми из тех, что указаны здесь на вкладке Versions: https://www.npmjs.com/package/es-abstract

Желательно 1.14.1.

А вот почему автор в принципе допускает постоянно такие косяки это, конечно, вопрос. Думаю сорцы тут лежат просто потому что надо, работа коммьюнити с этим кодом не предусмотрена в принципе, а у автора УМВР.

savely-krasovsky avatar Feb 18 '20 11:02 savely-krasovsky