现有模块的npm安装中的JSON中出现意外字符串

时间:2018-02-05 20:39:08

标签: javascript json node.js reactjs npm

我几个小时后做了npm update,现在看来我不能再做npm install了。每次我这样做,我都会收到错误

Unexpected string in JSON on npm install for existing module

我的日志似乎表明它位于模块bluebird中,如下所示:

13 verbose stack SyntaxError: Unexpected string in JSON at position 493 13 verbose stack at JSON.parse (<anonymous>) 13 verbose stack at module.exports (/usr/local/lib/node_modules/npm/lib/utils/parse-json.js:3:15) 13 verbose stack at BB.join (/usr/local/lib/node_modules/npm/lib/install/read-shrinkwrap.js:31:20) 13 verbose stack at tryCatcher (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/util.js:16:23) 13 verbose stack at Holder$3._callFunction (eval at generateHolderClass (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/join.js:92:16), <anonymous>:14:44) 13 verbose stack at Holder$3.checkFulfillment (eval at generateHolderClass (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/join.js:92:16), <anonymous>:29:30) 13 verbose stack at Promise.eval (eval at thenCallback (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/join.js:14:16), <anonymous>:6:20) 13 verbose stack at Promise._settlePromise (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:566:21) 13 verbose stack at Promise._settlePromise0 (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:614:10) 13 verbose stack at Promise._settlePromises (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:693:18) 13 verbose stack at Promise._fulfill (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:638:18) 13 verbose stack at Promise._settlePromise (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:582:21) 13 verbose stack at Promise._settlePromise0 (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:614:10) 13 verbose stack at Promise._settlePromises (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:693:18) 13 verbose stack at Promise._fulfill (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:638:18) 13 verbose stack at /usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/nodeback.js:42:21 14 verbose cwd /Users/ 15 verbose Darwin 17.3.0 16 verbose argv "/usr/local/Cellar/node/8.9.1/bin/node" "/usr/local/bin/npm" "install" 17 verbose node v8.9.1 18 verbose npm v5.5.1 19 error Unexpected string in JSON at position 493 20 verbose exit [ 1, true ]

所以很明显问题出现在bluebird内。我尝试更新它但它没有帮助,似乎唯一的方法是删除本地副本。这似乎是babel的依赖,所以我不认为删除它是正确的方法。还有其他方法可以解决这个问题吗?

编辑所以我使用rm -rf /usr/local/lib/node_modules/npm/node_modules/bluebird从我的系统中删除了bluebird的本地副本,但是当我尝试使用npm install bluebird再次安装它时,我收到错误{{ 1}} MODULE_NOT_FOUND

0 个答案:

没有答案