您好,每当我尝试在pet-shop-project教程的终端中运行npm run dev
时,它会在错误下方找到一长串错误。
希望在你的帮助下解决问题。
提前致谢。
PS C:\pet-shop-tutorial> npm run dev
> pet-shop@1.0.0 dev C:\pet-shop-tutorial
> lite-server
npm : C:\Users\Ali\AppData\Roaming\npm\node_modules\lite-server\lib\lite-server.js:33
At line:1 char:1
+ npm run dev
+ ~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (C:\Users\Ali\Ap...te-server.js:33:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
throw (err);
^
SyntaxError: C:\pet-shop-tutorial\bs-config.json: Unexpected token } in JSON at position 70
at JSON.parse (<anonymous>)
at Object.Module._extensions..json (module.js:671:27)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at start (C:\Users\Ali\AppData\Roaming\npm\node_modules\lite-server\lib\lite-server.js:28:17)
at Object.<anonymous> (C:\Users\Ali\AppData\Roaming\npm\node_modules\lite-server\bin\lite-server:7:30)
at Module._compile (module.js:652:30)
npm
ERR!
code
ELIFECYCLE
npm
ERR!
errno
1
npm
ERR!
pet-shop@1.0.0 dev: `lite-server`
npm
ERR!
Exit status 1
npm
ERR!
npm
ERR!
Failed at the pet-shop@1.0.0 dev script.
npm
ERR!
This is probably not a problem with npm. There is likely additional logging output above.
npm
ERR!
A complete log of this run can be found in:
npm
ERR!
C:\Users\Ali\AppData\Roaming\npm-cache\_logs\2018-05-30T01_41_54_260Z-debug.log
bs-config-json内容
{
"server": {
"baseDir": ["./src", "./build/contracts"],
}
}
答案 0 :(得分:0)
bs-config.json
的内容无效JSON。数组后面有一个额外的逗号。它应该是这样的:
{ "server": { "baseDir": ["./src", "./build/contracts"] } }
这就是您收到此错误的原因:
SyntaxError: C:\pet-shop-tutorial\bs-config.json: Unexpected token } in JSON at position 70
您可以使用https://jsonlint.com/等JSON验证程序验证您的JSON。