javascript - 在执行“npm install”时,它显示“在 '...FFso8TBG3jS7\nYdtExKk' 附近解析时 JSON 输入意外结束”
问题描述
所以,我正在尝试通过官方指南(https://codelabs.developers.google.com/codelabs/tensorflowjs-nodejs-codelab/#2)做一些 TensorFLow。我已经下载了 package.json 和 webpack.config.js。
pacakage.json 如下:
{
"name": "tfjs-examples-baseball-node",
"version": "0.2.0",
"description": "Deep learning models for classifying baseball metrics",
"scripts": {
"start-client": "webpack && webpack-dev-server",
"start-server": "node server.js"
},
"license": "Apache-2.0",
"devDependencies": {
"clang-format": "~1.2.3",
"mkdirp": "~0.5.1",
"webpack": "~4.28.4",
"webpack-cli": "^3.3.2",
"webpack-dev-server": "~3.4.1"
},
"dependencies": {
"@tensorflow/tfjs-node": "^1.3.2",
"argparse": "^1.0.10",
"socket.io": "~2.2.0"
}
}
webpack.congig.js 看起来像这样:
const path = require('path');
module.exports = {
entry: './client.js',
output: {path: path.resolve(__dirname, 'dist'), filename: 'bundle.js'},
devServer: {
historyApiFallback: true,
noInfo: true,
host: '0.0.0.0',
disableHostCheck: true
}
};
当我运行“npm install”时。它安装了一些东西,但不是所有东西,并给出了以下错误:
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm ERR! Unexpected end of JSON input while parsing near '...FFso8TBG3jS7\nYdtExKk'
我已经尝试过npm cache clear --force
,但它仍然无法正常工作。我试过npm install -g
了,它显然安装了所有依赖项,但只安装了 dev-dependencies 中的 mkdirp ,而其他所有依赖项都被卸载了。
有人可以建议尝试一下吗?
解决方案
对于 Mac 操作系统用户,
- 首先运行“npm cache clean --force”
- 然后运行“npm i”
推荐阅读
- json - 空手道删除 JSON 的不同部分
- php - PHP PDO未定义索引错误使用Fileuploader类
- python - 解析文本文件并从中创建 json
- powershell - 如何运行一次 Get-Credential,然后在同一会话中存储凭据并重用凭据
- javascript - 从父母传递给孩子的onChange函数不起作用
- python - Django Models - SQL 等效的多个表加入 DJANGO
- unit-testing - Junit5 模拟一个静态方法
- excel - Excel成绩公式
- azure-sql-managed-instance - 由于在 azure sql 托管实例中运行备份,ALTER DATABASE ADD FILE 失败
- javascript - JavaScript/HTML(移动):当页面部分滚动时,在完成滚动之前我什么都做不了