@incel

Как подключить пакет к node.js вручную?

Положил express.tgz в c:/node и исполнил следующие команды:
$ cd c:/node
$ npm install ./express.tgz


Результат:
npm ERR! code ECONNRESET
npm ERR! errno ECONNRESET
npm ERR! network request to https://registry.npmjs.org/depd failed, reason: read ECONNRESET
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly.  See: 'npm help config'

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\%username%\AppData\Roaming\npm-cache\_logs\2018-11-19T15_32_29_036Z-debug.log


Вроде бы делаю установку вручную, т.к. сервер автономный, без доступа к интернету, а npm все равно рвется на свои сервера. Как от этого избавиться?
Как правильно установить пакет?
Спасибо

Прикладываю состав log-файла
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'install',
1 verbose cli   './express.tgz' ]
2 info using npm@6.4.1
3 info using node@v10.13.0
4 verbose npm-session 63b80a8effda4353
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 silly pacote file manifest for undefined@file:express.tgz fetched in 222ms
8 timing stage:loadCurrentTree Completed in 1147ms
9 silly install loadIdealTree
10 silly install cloneCurrentTreeToIdealTree
11 timing stage:loadIdealTree:cloneCurrentTree Completed in 2ms
12 silly install loadShrinkwrap
13 timing stage:loadIdealTree:loadShrinkwrap Completed in 24ms
14 silly install loadAllDepsIntoIdealTree
15 silly resolveWithNewModule express@4.16.4 checking installable status
16 silly removeObsoleteDep removing express@4.16.4 from the tree as its been replaced by a newer version or is no longer required
17 silly fetchPackageMetaData error for depd@~1.1.2 request to https://registry.npmjs.org/depd failed, reason: read ECONNRESET
18 silly fetchPackageMetaData error for content-disposition@0.5.2 request to https://registry.npmjs.org/content-disposition failed, reason: read ECONNRESET
19 silly fetchPackageMetaData error for cookie@0.3.1 request to https://registry.npmjs.org/cookie failed, reason: read ECONNRESET
20 silly fetchPackageMetaData error for accepts@~1.3.5 request to https://registry.npmjs.org/accepts failed, reason: read ECONNRESET
21 silly fetchPackageMetaData error for array-flatten@1.1.1 request to https://registry.npmjs.org/array-flatten failed, reason: read ECONNRESET
22 silly fetchPackageMetaData error for encodeurl@~1.0.2 request to https://registry.npmjs.org/encodeurl failed, reason: read ECONNRESET
23 silly fetchPackageMetaData error for content-type@~1.0.4 request to https://registry.npmjs.org/content-type failed, reason: read ECONNRESET
24 silly fetchPackageMetaData error for body-parser@1.18.3 request to https://registry.npmjs.org/body-parser failed, reason: read ECONNRESET
25 silly fetchPackageMetaData error for cookie-signature@1.0.6 request to https://registry.npmjs.org/cookie-signature failed, reason: read ECONNRESET
26 silly fetchPackageMetaData error for debug@2.6.9 request to https://registry.npmjs.org/debug failed, reason: read ECONNRESET
27 silly fetchPackageMetaData error for parseurl@~1.3.2 request to https://registry.npmjs.org/parseurl failed, reason: read ECONNRESET
28 silly fetchPackageMetaData error for finalhandler@1.1.1 request to https://registry.npmjs.org/finalhandler failed, reason: read ECONNRESET
29 silly fetchPackageMetaData error for on-finished@~2.3.0 request to https://registry.npmjs.org/on-finished failed, reason: read ECONNRESET
30 silly fetchPackageMetaData error for etag@~1.8.1 request to https://registry.npmjs.org/etag failed, reason: read ECONNRESET
31 silly fetchPackageMetaData error for path-to-regexp@0.1.7 request to https://registry.npmjs.org/path-to-regexp failed, reason: read ECONNRESET
32 silly fetchPackageMetaData error for fresh@0.5.2 request to https://registry.npmjs.org/fresh failed, reason: read ECONNRESET
33 silly fetchPackageMetaData error for proxy-addr@~2.0.4 request to https://registry.npmjs.org/proxy-addr failed, reason: read ECONNRESET
34 silly fetchPackageMetaData error for escape-html@~1.0.3 request to https://registry.npmjs.org/escape-html failed, reason: read ECONNRESET
35 silly fetchPackageMetaData error for methods@~1.1.2 request to https://registry.npmjs.org/methods failed, reason: read ECONNRESET
36 silly fetchPackageMetaData error for merge-descriptors@1.0.1 request to https://registry.npmjs.org/merge-descriptors failed, reason: read ECONNRESET
37 silly fetchPackageMetaData error for serve-static@1.13.2 request to https://registry.npmjs.org/serve-static failed, reason: read ECONNRESET
38 silly fetchPackageMetaData error for qs@6.5.2 request to https://registry.npmjs.org/qs failed, reason: read ECONNRESET
39 silly fetchPackageMetaData error for utils-merge@1.0.1 request to https://registry.npmjs.org/utils-merge failed, reason: read ECONNRESET
40 silly fetchPackageMetaData error for range-parser@~1.2.0 request to https://registry.npmjs.org/range-parser failed, reason: read ECONNRESET
41 silly fetchPackageMetaData error for setprototypeof@1.1.0 request to https://registry.npmjs.org/setprototypeof failed, reason: read ECONNRESET
42 silly fetchPackageMetaData error for safe-buffer@5.1.2 request to https://registry.npmjs.org/safe-buffer failed, reason: read ECONNRESET
43 silly fetchPackageMetaData error for statuses@~1.4.0 request to https://registry.npmjs.org/statuses failed, reason: read ECONNRESET
44 silly fetchPackageMetaData error for send@0.16.2 request to https://registry.npmjs.org/send failed, reason: read ECONNRESET
45 silly fetchPackageMetaData error for type-is@~1.6.16 request to https://registry.npmjs.org/type-is failed, reason: read ECONNRESET
46 silly fetchPackageMetaData error for vary@~1.1.2 request to https://registry.npmjs.org/vary failed, reason: read ECONNRESET
47 timing stage:rollbackFailedOptional Completed in 2ms
48 timing stage:runTopLevelLifecycles Completed in 212059ms
49 silly saveTree alms@1.0.0
49 silly saveTree `-- express@4.16.4
50 verbose type system
51 verbose stack FetchError: request to https://registry.npmjs.org/depd failed, reason: read ECONNRESET
51 verbose stack     at ClientRequest.req.on.err (C:\Program Files\nodejs\node_modules\npm\node_modules\node-fetch-npm\src\index.js:68:14)
51 verbose stack     at ClientRequest.emit (events.js:182:13)
51 verbose stack     at TLSSocket.socketErrorListener (_http_client.js:391:9)
51 verbose stack     at TLSSocket.emit (events.js:182:13)
51 verbose stack     at emitErrorNT (internal/streams/destroy.js:82:8)
51 verbose stack     at emitErrorAndCloseNT (internal/streams/destroy.js:50:3)
51 verbose stack     at process._tickCallback (internal/process/next_tick.js:63:19)
52 verbose cwd c:\node
53 verbose Windows_NT 10.0.14393
54 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "./express.tgz"
55 verbose node v10.13.0
56 verbose npm  v6.4.1
57 error code ECONNRESET
58 error errno ECONNRESET
59 error network request to https://registry.npmjs.org/depd failed, reason: read ECONNRESET
60 error network This is a problem related to network connectivity.
60 error network In most cases you are behind a proxy or have bad network settings.
60 error network
60 error network If you are behind a proxy, please make sure that the
60 error network 'proxy' config is set properly.  See: 'npm help config'
61 verbose exit [ 1, true ]

  • Вопрос задан
  • 762 просмотра
Пригласить эксперта
Ответы на вопрос 2
@utyfua
Можно просто правильно положить содержимое архива в папку node_modules
Если модуль на месте, то может не работать по двум причинам:
- зависимости отсутствуют. Можно опять же также аккуратненько один за одним тащить, но это мутно.
- не выполнен скрипт при установке пакета.
Если брать экспресс, то зависимостей там 30 шт(кликабельно). Если операционные системы одинаковые, можно вариант с комментария - установить на рабочей машине и аккуратненько перенести.
Также стоит помнить что модули в зависимостях, могут быть также зависимы от других модулей.
Ответ написан
Комментировать
MDiMaI666
@MDiMaI666
Талантливый программист
1. Извлечь архив в node_modules
2. скопировать на флешку или через фтп node_modules

если хочется в package засунуть то
npm init создаст этот файл
Далее туда занести
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы