nodejs react : build script in package.json file not working when commanding yarn build

invalid instanceof'' keyword value promise webpack
error('invalid instanceof'' keyword value promise webpack)
webpack-dev-server invalid "instanceof" keyword value promise
create-react-app
invalid "instanceof" keyword value promise webpack-cli
error invalid instanceof keyword value promise webpack-dev-server
yarn 'react-scripts' is not recognized as an internal or external command,
react-scripts' is not recognized as an internal or external command yarn start

Both on linux and windows when I run the yarn build command after making the following edits on package.json:

{  
"name": "chatastrophe",  
"version": "1.0.0", 
 "main": "index.js",
  "license": "MIT", 
 "scripts": {  
  "build": "node_modules/.bin/webpack",
'  }, 
 "dependencies": {   
 "react": "15.6.1",  
  "react-dom": "15.6.1", 
   "webpack": "3.5.4",
  } 
}

I keep getting this error:

error An unexpected error occurred: "C:\Users\Richard\Desktop\chatastrophe\package.json: Unexpected token } in JSON at position 175". info If you think this is a bug, please open a bug report with the information provided in "C:\Users\Richard\Desktop\chatastrophe\yarn-error.log".

a more detailed version of this error is as follows (when I use npm instead of yarn)

npm ERR! file C:\Users\Richard\Desktop\chatastrophe\package.json
npm ERR! code EJSONPARSE
npm ERR! Failed to parse json
npm ERR! Unexpected token } in JSON at position 175 while parsing near '...webpack",
npm ERR!           },
npm ERR!         "dependen...'
npm ERR! File: C:\Users\Richard\Desktop\chatastrophe\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

can anyone please help me out. Thanks in advance.

Your package.json build script is invalid JSON, theres a single quote mark after the comma. Try this:

 {
  "name": "chatastrophe",
  "version": "1.0.0", "main": "index.js", "license": "MIT", 
  "scripts": {
    "build": "node_modules/.bin/webpack" 
  }, 
  "dependencies": {
    "react": "15.6.1",
    "react-dom": "15.6.1", "webpack": "3.5.4", 
   } 
} 

public, src,and scripts folder not created while installing react-app , Folder with node_modules, package.json and packageloack.json is created but Tried reinstalling nodejs, clearing cache etc. nothing worked. create a new folder by running this command mkdir react-app if it doesnt work you need to install yarn globally by running this command npm install -g yarn. 'yarn' is not recognized as an internal or external command, operable program or batch file. #2504. rhtpandeyIN opened this issue on Jan 19, 2017 · 43 comments. cat-bug os-windows. rhtpandeyIN commented on Jan 19, 2017 • nodejs version: 7.4.0. I installed yarn by using yarn.msi file, and it installed successfully. But when I tried to check

Thanks, it worked a bit until I had to run a webpack dev server ... i got this error shown below:

lelo@lelo-Latitude-E6220:~/Desktop/chatastrophe$ npm run start

> chatastrophe@1.0.0 start /home/lelo/Desktop/chatastrophe
> webpack-dev-server

/home/lelo/Desktop/chatastrophe/node_modules/ajv-keywords/keywords/instanceof.js:52
    throw new Error('invalid "instanceof" keyword value ' + c);
    ^

Error: invalid "instanceof" keyword value Promise
    at getConstructor (/home/lelo/Desktop/chatastrophe/node_modules/ajv-keywords/keywords/instanceof.js:52:11)
    at Ajv.compile (/home/lelo/Desktop/chatastrophe/node_modules/ajv-keywords/keywords/instanceof.js:21:27)
    at Object.useCustomRule (/home/lelo/Desktop/chatastrophe/node_modules/ajv/lib/compile/index.js:275:26)
    at Object.generate_custom [as code] (/home/lelo/Desktop/chatastrophe/node_modules/ajv/lib/dotjs/custom.js:32:24)
    at Object.generate_validate [as validate] (/home/lelo/Desktop/chatastrophe/node_modules/ajv/lib/dotjs/validate.js:347:35)
    at Object.generate_anyOf [as code] (/home/lelo/Desktop/chatastrophe/node_modules/ajv/lib/dotjs/anyOf.js:34:27)
    at generate_validate (/home/lelo/Desktop/chatastrophe/node_modules/ajv/lib/dotjs/validate.js:347:35)
    at localCompile (/home/lelo/Desktop/chatastrophe/node_modules/ajv/lib/compile/index.js:87:22)
    at Ajv.compile (/home/lelo/Desktop/chatastrophe/node_modules/ajv/lib/compile/index.js:56:13)
    at Ajv._compile (/home/lelo/Desktop/chatastrophe/node_modules/ajv/lib/ajv.js:358:27)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! chatastrophe@1.0.0 start: `webpack-dev-server`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the chatastrophe@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

'react-scripts' is not recognized as an internal or external command , Yes I have cleared both node_modules and package-lock.json via Powershell. Troubleshoot, create-react-app, react-scripts, "not recognized as an internal or external command", npm scripts npm: 6.9.0 - C:\Program Files\nodejs\npm. used the following command to make it work, since yarn start fails. Note that npm install will still run on every build and will update/install any new packages added to your package.json file. Even when script is overridden, this shortcut is effective. Using yarn # Travis CI detects use of yarn. If both package.json and yarn.lock are present in the current directory, we run the following command instead of npm

"scripts": {
        "dev": "npm run development",
        "development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
        "watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
        "watch-poll": "npm run watch -- --watch-poll",
        "hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
        "prod": "npm run production",
        "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
    },

4 Solutions To Run Multiple Node.js or NPM Commands , At Some Point, Everyone Has this Problem… Fun fact: the "scripts” in a package.json file are actually just terminal That's the quickest, easiest, most built-in way to run multiple Node.js commands in different file locations, at once. start command like: npm run clean && npm run build:css && npm run  npm ERR! missing script: start Solution: You need to tell npm what to do when you run npm start explicitly by editing package.json. First, identify the main file of your application. Most often it is called index.js, server.js or app.js. When you open package.json in an editor, you can also often find a line like "main": "index.js",

The solution was to update my package.json file to include the following scripts and dependencies:

    "build": "node scripts/copy_assets.js && node_modules/.bin/webpack --config webpack.config.prod.js",
    "start": "node_modules/.bin/webpack-dev-server",
    "deploy": "npm run build && firebase deploy"
  },
  "dependencies": {
    "babel-core": "^6.25.0",
    "babel-loader": "^7.1.1",
    "babel-plugin-transform-class-properties": "^6.24.1",
    "babel-preset-es2015": "^6.24.1",
    "babel-preset-react": "^6.24.1",
    "css-loader": "^0.28.4",
    "file-loader": "^0.11.2",
    "fs-extra": "^4.0.1",
    "html-webpack-plugin": "^2.30.1",
    "react": "^15.6.1",
    "react-dom": "^15.6.1",
    "react-hot-loader": "3.0.0",
    "react-router-dom": "^4.2.2",
    "style-loader": "^0.18.2",
    "webpack": "^3.5.4",
    "webpack-dev-server": "^2.7.1",
    "webpack-manifest-plugin": "^1.3.1"
  },
  "devDependencies": {
    "babel-preset-stage-2": "^6.24.1"
  }
}

How To Set Up a React Project with Create React App, But now, Create React App includes all the JavaScript packages you need to run a look at our How To Use Node.js Modules with npm and package.json tutorial. Originally, yarn provided new functionality such as lock files, but now these are Like npm test , this script does not need the run command. Because Yarn understands that. * Heroku Deployment: Adds a note on how to resolve "File/Module Not Found Errors" (facebook#1260) * Adds note on how to resolve file or directory not found errors for heroku deployments * Style tweaks * Remove interactive shell check when opening browser on start (facebook#1264) Browser launch can still be suppressed using BROWSER=none * Only gitignore dirs in

The package.json guide, The package.json file is a key element in lots of app codebases based on the If you work with JavaScript, or you've ever interacted with a JavaScript project It's also where npm and yarn store the names and versions for all the installed packages. If you're building a Node.js package that you want to distribute over npm  Tutorial: Create a Node.js and React app in Visual Studio. 4/21/2020; 16 minutes to read +3; In this article. Visual Studio allows you to easily create a Node.js project and experience IntelliSense and other built-in features that support Node.js.

Heroku Node.js Build Script Change FAQ, This document covers additional questions about the Node.js Build Script change now execute your Node.js app's build script if it is defined in the app's package.​json file. Heroku with tools like webpack, create-react-app, Next.js, Vue.js, and many others. If you are already using postinstall today it will not stop working. Dismiss Join GitHub today. GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.

How to run more than one command as part of a npm script – Corey , Up until now you might have only run one command per script – often npm start just does something like node In your package.json file, it would look like this:. In this article, I will show how you can set up a Node.js environment on Windows 10, and I’ll checkout and run the project I'm currently working on (which depends on koa, pg, amqplib and other modules). Note, that the primary focus right now is just setting up a developer environment for a Node.js project, not running one.

Comments
  • any solution to this? I have exactly the same error as above