не удалось установить определение типа запроса в машинописи - PullRequest
1 голос
/ 05 февраля 2020

Я новичок в typescript. Поскольку я следовал видеоинструкции по использованию request api. Для установки библиотеки запросов я использовал следующую команду:

npm install request --save

Затем, чтобы использовать автозаполнение в редакторе кода Visual Studio для машинописного текста, я попытался установить определение типа для запроса:

npm install @types/request --save-dev

Но при этом я получил следующую ошибку:

npm ERR! Unexpected end of JSON input while parsing near '...57","dependencies":{}'

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\ABC\AppData\Roaming\npm-cache\_logs\2020-02-05T09_09_06_453Z-debug.log

Я даже перешел по этой ссылке: https://www.npmjs.com/package/@types / request

видеоурок, которым я был следующее было: это

ПРИМЕЧАНИЕ : Я сталкиваюсь с этой проблемой в моем windows 7 ноутбуке. Когда я пытался выполнить те же действия на другом ноутбуке с windows 10, все команды выполнялись гладко. Без ошибок.

, пожалуйста, скажите мне, что я могу сделать дальше, чтобы продолжить практику и изучение этого REQUEST topi c.

пакета. json file

{
  "name": "typescriptbasics",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
   "start":"tsc && node ./out/index.js",
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "lodash": "^4.17.15",
    "request": "^2.88.0"
  },
  "devDependencies": {
    "@types/lodash": "^4.14.149"
  }
}

Полный журнал ошибок

0 info it worked if it ends with ok
1 verbose cli [
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   '@types/request',
1 verbose cli   '--save-dev'
1 verbose cli ]
2 info using npm@6.12.1
3 info using node@v12.13.1
4 verbose npm-session fb9add68865522cb
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 http fetch GET 304 https://registry.npmjs.org/@types%2frequest 247ms (from cache)
8 silly pacote tag manifest for @types/request@latest fetched in 263ms
9 timing stage:loadCurrentTree Completed in 1271ms
10 silly install loadIdealTree
11 silly install cloneCurrentTreeToIdealTree
12 timing stage:loadIdealTree:cloneCurrentTree Completed in 1ms
13 silly install loadShrinkwrap
14 timing stage:loadIdealTree:loadShrinkwrap Completed in 133ms
15 silly install loadAllDepsIntoIdealTree
16 silly resolveWithNewModule @types/request@2.48.4 checking installable status
17 http fetch GET 304 https://registry.npmjs.org/@types%2fcaseless 72ms (from cache)
18 silly pacote range manifest for @types/caseless@* fetched in 73ms
19 silly resolveWithNewModule @types/caseless@0.12.2 checking installable status
20 http fetch GET 304 https://registry.npmjs.org/@types%2fnode 134ms (from cache)
21 silly fetchPackageMetaData error for @types/node@* Unexpected end of JSON input while parsing near '...57","dependencies":{}'
22 http fetch GET 304 https://registry.npmjs.org/@types%2ftough-cookie 143ms (from cache)
23 silly pacote range manifest for @types/tough-cookie@* fetched in 146ms
24 silly resolveWithNewModule @types/tough-cookie@2.3.6 checking installable status
25 http fetch GET 304 https://registry.npmjs.org/form-data 151ms (from cache)
26 silly pacote range manifest for form-data@^2.5.0 fetched in 153ms
27 silly resolveWithNewModule form-data@2.5.1 checking installable status
28 timing stage:rollbackFailedOptional Completed in 1ms
29 timing stage:runTopLevelLifecycles Completed in 1570ms
30 silly saveTree typescriptbasics@1.0.0
30 silly saveTree +-- @types/lodash@4.14.149
30 silly saveTree +-- @types/request@2.48.4
30 silly saveTree | +-- @types/caseless@0.12.2
30 silly saveTree | +-- @types/tough-cookie@2.3.6
30 silly saveTree | `-- form-data@2.5.1
30 silly saveTree |   +-- asynckit@0.4.0
30 silly saveTree |   +-- combined-stream@1.0.8
30 silly saveTree |   | `-- delayed-stream@1.0.0
30 silly saveTree |   `-- mime-types@2.1.26
30 silly saveTree |     `-- mime-db@1.43.0
30 silly saveTree +-- lodash@4.17.15
30 silly saveTree `-- request@2.88.0
30 silly saveTree   +-- aws-sign2@0.7.0
30 silly saveTree   +-- aws4@1.9.1
30 silly saveTree   +-- caseless@0.12.0
30 silly saveTree   +-- extend@3.0.2
30 silly saveTree   +-- forever-agent@0.6.1
30 silly saveTree   +-- form-data@2.3.3
30 silly saveTree   +-- har-validator@5.1.3
30 silly saveTree   | +-- ajv@6.11.0
30 silly saveTree   | | +-- fast-deep-equal@3.1.1
30 silly saveTree   | | +-- fast-json-stable-stringify@2.1.0
30 silly saveTree   | | +-- json-schema-traverse@0.4.1
30 silly saveTree   | | `-- uri-js@4.2.2
30 silly saveTree   | |   `-- punycode@2.1.1
30 silly saveTree   | `-- har-schema@2.0.0
30 silly saveTree   +-- http-signature@1.2.0
30 silly saveTree   | +-- assert-plus@1.0.0
30 silly saveTree   | +-- jsprim@1.4.1
30 silly saveTree   | | +-- extsprintf@1.3.0
30 silly saveTree   | | +-- json-schema@0.2.3
30 silly saveTree   | | `-- verror@1.10.0
30 silly saveTree   | |   `-- core-util-is@1.0.2
30 silly saveTree   | `-- sshpk@1.16.1
30 silly saveTree   |   +-- asn1@0.2.4
30 silly saveTree   |   | `-- safer-buffer@2.1.2
30 silly saveTree   |   +-- bcrypt-pbkdf@1.0.2
30 silly saveTree   |   | `-- tweetnacl@0.14.5
30 silly saveTree   |   +-- dashdash@1.14.1
30 silly saveTree   |   +-- ecc-jsbn@0.1.2
30 silly saveTree   |   | `-- jsbn@0.1.1
30 silly saveTree   |   +-- getpass@0.1.7
30 silly saveTree   |   +-- jsbn@0.1.1
30 silly saveTree   |   +-- safer-buffer@2.1.2
30 silly saveTree   |   `-- tweetnacl@0.14.5
30 silly saveTree   +-- is-typedarray@1.0.0
30 silly saveTree   +-- isstream@0.1.2
30 silly saveTree   +-- json-stringify-safe@5.0.1
30 silly saveTree   +-- oauth-sign@0.9.0
30 silly saveTree   +-- performance-now@2.1.0
30 silly saveTree   +-- qs@6.5.2
30 silly saveTree   +-- safe-buffer@5.2.0
30 silly saveTree   +-- tough-cookie@2.4.3
30 silly saveTree   | +-- psl@1.7.0
30 silly saveTree   | `-- punycode@1.4.1
30 silly saveTree   +-- tunnel-agent@0.6.0
30 silly saveTree   `-- uuid@3.4.0
31 verbose stack SyntaxError: Unexpected end of JSON input while parsing near '...57","dependencies":{}'
31 verbose stack     at JSON.parse (<anonymous>)
31 verbose stack     at parseJson (C:\Program Files\nodejs\node_modules\npm\node_modules\json-parse-better-errors\index.js:7:17)
31 verbose stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\node-fetch-npm\src\body.js:96:50
31 verbose stack     at processTicksAndRejections (internal/process/task_queues.js:93:5)
32 verbose cwd C:\Users\Wpits\Downloads\Chili\TypeScriptBasics
33 verbose Windows_NT 6.1.7601
34 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "@types/request" "--save-dev"
35 verbose node v12.13.1
36 verbose npm  v6.12.1
37 error Unexpected end of JSON input while parsing near '...57","dependencies":{}'
38 verbose exit [ 1, true ]
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...