对任何模块执行npm install或npm install时,NPM INSTALL都会生成错误

时间:2018-08-09 18:36:19

标签: node.js npm-install

这是我的错误

13 silly saveTree `-- zone.js@0.8.26  <-- LAST GOOD INSTALL OF A MODULE
14 verbose stack SyntaxError: Unexpected token < in JSON at position 258612
14 verbose stack     at JSON.parse (<anonymous>)
14 verbose stack     at module.exports (C:\Program Files\nodejs\node_modules\npm\lib\utils\parse-json.js:3:15)
14 verbose stack     at BB.join (C:\Program Files\nodejs\node_modules\npm\lib\install\read-shrinkwrap.js:31:20)
14 verbose stack     at tryCatcher (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\util.js:16:23)
14 verbose stack     at Holder$3._callFunction (eval at generateHolderClass (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\join.js:92:16), <anonymous>:14:44)
14 verbose stack     at Holder$3.checkFulfillment (eval at generateHolderClass (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\join.js:92:16), <anonymous>:29:30)
14 verbose stack     at Promise.eval (eval at thenCallback (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\join.js:14:16), <anonymous>:6:20)
14 verbose stack     at Promise._settlePromise (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\promise.js:566:21)
14 verbose stack     at Promise._settlePromise0 (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\promise.js:614:10)
14 verbose stack     at Promise._settlePromises (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\promise.js:693:18)
14 verbose stack     at Promise._fulfill (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\promise.js:638:18)
14 verbose stack     at Promise._settlePromise (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\promise.js:582:21)
14 verbose stack     at Promise._settlePromise0 (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\promise.js:614:10)
14 verbose stack     at Promise._settlePromises (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\promise.js:693:18)
14 verbose stack     at Promise._fulfill (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\promise.js:638:18)
14 verbose stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\nodeback.js:42:21
15 verbose cwd C:\inetpub\wwwroot\repos\forms-ui
16 verbose Windows_NT 10.0.16299
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
18 verbose node v8.11.1
19 verbose npm  v5.6.0
20 error Unexpected token < in JSON at position 258612
21 verbose exit [ 1, true ]

我不明白为什么这突然发生了。

我要走的步骤:

  1. 我转储了节点模块文件夹
  2. 我对Origin / develop进行了一次硬重置,以重新安装好
  3. 我注意到我的JSON对象在保存时未将自身格式化为STRAIGHT行
  4. 发出npm install或npm install --save并得到此错误:

    $ npm安装 npm ERR! JSON中的意外令牌<在位置258612

    npm错误!可以在以下位置找到此运行的完整日志: npm ERR! C:\ Users \ pborreggine \ AppData \ Roaming \ npm-cache_logs \ 2018-08-09T17_40_28_820Z-debug.log

以前有人见过或经历过吗?

更新:

在此github线程中找到的建议之一是删除package.lock文件,然后重试。该SO线程中还有其他一些建议。

我这样做了,但是现在我的package.json格式不正确,现在出现了这个错误:

$ npm install
npm ERR! file C:\inetpub\wwwroot\repos\myproject\package.json
npm ERR! code EJSONPARSE
npm ERR! Failed to parse json
npm ERR! Unexpected string in JSON at position 2121 while parsing '{
npm ERR!   "name": "forms-ui", "version": "2.0'
npm ERR! File: C:\inetpub\wwwroot\repos\myproject\package.json
npm ERR! Failed to parse package.json data.
npm ERR! package.json must be actual JSON, not just JavaScript.
npm ERR!
npm ERR! Tell the package author to fix their package.json file. JSON.parse

npm ERR! A complete log of this run can be found in:

JSON包现在是ALL STRAIGHT LINES,当我尝试将FORMAT格式化为JSON时,在NETBEANS 8.2中保存时,它拒绝保留它。

对不起,所有大写字母。是为了强调。

0 个答案:

没有答案