I've been tryna fix this for a while, but I can't seem to figure it out. Considering I'm new to coding it may be an easy fix and I'm just not quite sure about what I'm doing'
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 'discord.io',
1 verbose cli 'winston',
1 verbose cli '-save'
1 verbose cli ]
2 info using [email protected]
3 info using [email protected]
4 verbose npm-session 39d5088f2ca6dfd0
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 timing stage:rollbackFailedOptional Completed in 3ms
8 timing stage:runTopLevelLifecycles Completed in 28ms
9 verbose stack Error: Failed to parse json
9 verbose stack Unexpected token n in JSON at position 7 while parsing near '{
9 verbose stack name: “Blotch”
9 verbose stack ...'
9 verbose stack at parseError (C:Program Filesnodejsnode_modulesnpmnode_modulesread-package-jsonread-json.js:452:11)
9 verbose stack at parseJson (C:Program Filesnodejsnode_modulesnpmnode_modulesread-package-jsonread-json.js:104:26)
9 verbose stack at C:Program Filesnodejsnode_modulesnpmnode_modulesread-package-jsonread-json.js:51:5
9 verbose stack at C:Program Filesnodejsnode_modulesnpmnode_modulesgraceful-fsgraceful-fs.js:90:16
9 verbose stack at FSReqCallback.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:61:3)
10 verbose cwd C:UsersThornstrider StudiosDesktopDiscordbot
11 verbose Windows_NT 10.0.17134
12 verbose argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install" "discord.io" "winston" "-save"
13 verbose node v12.5.0
14 verbose npm v6.9.0
15 error file C:UsersThornstrider StudiosDesktopDiscordbotpackage.json
16 error code EJSONPARSE
17 error JSON.parse Failed to parse json
17 error JSON.parse Unexpected token n in JSON at position 7 while parsing near '{
17 error JSON.parse name: “Blotch”
17 error JSON.parse ...'
18 error JSON.parse Failed to parse package.json data.
18 error JSON.parse package.json must be actual JSON, not just JavaScript.
19 verbose exit [ 1, true ]
This is what package.json says;
{
name: “Blotch”,
version: “1.0.0”,
main: “bot.js”,
author: “Marsh”,
dependencies: {
}
Hi @Sunriselegacy, the package.json you posted there is not valid json. Object keys in json must be quoted, and you have an incomplete block, the correct file would be:
{
"name": "Blotch",
"version": "1.0.0",
"main": "bot.js",
"author": "Marsh",
"dependencies": { }
}
I would also add that a better way to create a package.json file is with $ npm init. There is a default one which creates a bare bones package.json file, but you can use the package create-package-json if you want more options and better defaults. For example: $ npm init package-json.
Disclaimer: I wrote and maintain create-package-json, sorry for the self promotion :)
Also, good luck learning to code, it is fun and worth the energy!
@Sunriselegacy Is this still an issue for you ?
Closing as resolved and doesn't seem to be an express issue.
If you need more help feel free to comment again.
Most helpful comment
Hi @Sunriselegacy, the
package.jsonyou posted there is not valid json. Object keys in json must be quoted, and you have an incomplete block, the correct file would be:I would also add that a better way to create a
package.jsonfile is with$ npm init. There is a default one which creates a bare bonespackage.jsonfile, but you can use the packagecreate-package-jsonif you want more options and better defaults. For example:$ npm init package-json.Disclaimer: I wrote and maintain
create-package-json, sorry for the self promotion :)Also, good luck learning to code, it is fun and worth the energy!