This is my package.json
{
"name": "server",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "node index.js",
"devStart": "nodemon index.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"body-parser": "^1.19.1",
"express": "^4.17.2",
"mysql": "^2.18.1"
},
"devDependencies": {
"nodemon": "^2.0.15"
}
}
When trying to run npm run devStart on visual studio code terminal for mac I get the following errors
% npm run devStart
npm ERR! Missing script: "devStart"
npm ERR! Did you mean this?
npm ERR! npm restart # Restart a package
npm ERR! To see a list of scripts, run:
npm ERR! npm run
...
Related
I've upgraded to Laravel 9 recently.
Here is my package.json:
{
"private": true,
"scripts": {
"dev": "vite",
"build": "vite build"
},
"devDependencies": {
"#vitejs/plugin-vue": "^3.0.3",
"autoprefixer": "^10.4.8",
"axios": "^0.21",
"laravel-mix": "^6.0.6",
"laravel-vite-plugin": "^0.6.0",
"lodash": "^4.17.19",
"postcss": "^8.4.16",
"tailwindcss": "^3.1.8",
"vite": "^3.0.9"
},
"dependencies": {
"alpinejs": "^3.8.1",
"laravel-echo": "^1.11.3",
"pusher-js": "^7.0.3"
},
"name": "beastburst-website",
"description": "<p align=\"center\"><img src=\"https://raw.githubusercontent.com/laravel/art/master/logo-lockup/5%20SVG/2%20CMYK/1%20Full%20Color/laravel-logolockup-cmyk-red.svg\" width=\"400\"></p>",
"version": "1.0.0",
"main": "tailwind.config.js",
"directories": {
"test": "tests"
},
"repository": {
"type": "git",
"url": "https://code.scarsgaming.net/BeastBurst/BeastBurst-Website.git"
},
"keywords": [],
"author": "",
"license": "ISC"
}
When I run npm run watch I get the following error:
npm ERR! Missing script: "watch"
npm ERR!
npm ERR! To see a list of scripts, run:
npm ERR! npm run
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/venelin/.npm/_logs/2022-08-31T11_40_11_910Z-debug-0.log
Any idea why and how can I fix that?
The default bundler for Laravel now is Vite as you can clearly see from your package.json
If you do not want to use Vite, use this guide to switch to mix
I should also mention that Vite is much faster that mix.
try npm run dev it will work like npm run watch that is because Laravel 9 now uses Vite.
First of all, I would like to apologize for the spelling mistakes, I'm not very good.
I have a problem whilethe starting my mern server...
I want to run it with with "npm run dev". This command line execute "npm run server" and "npm run client".
Here's my errors :
C:\Users\Jérémy\Desktop\Rendu\MERN\MERN_d04>npm run dev
mern_d04#1.0.0 dev C:\Users\Jérémy\Desktop\Rendu\MERN\MERN_d04
concurrently "npm run server" "npm run client"
[0] Error occurred when executing command: npm run server
[0] Error: spawn cmd.exe ENOENT
[0] at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
[0] at onErrorNT (internal/child_process.js:467:16)
[0] at processTicksAndRejections (internal/process/task_queues.js:84:21)
[1] Error occurred when executing command: npm run client
[1] Error: spawn cmd.exe ENOENT
[1] at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
[1] at onErrorNT (internal/child_process.js:467:16)
[1] at processTicksAndRejections (internal/process/task_queues.js:84:21)
[1] npm run client exited with code -4058
[0] npm run server exited with code -4058
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! mern_d04#1.0.0 dev: `concurrently "npm run server" "npm run client"`>npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the mern_d04#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\Jérémy\AppData\Roaming\npm-cache\_logs\2020-04-22T19_45_03_286Z-debug.log
And Here's, my root package.json :
{
"name": "mern_d04",
"version": "1.0.0",
"description": "",
"main": "server.js",
"scripts": {
"client-install": "npm-install --prefix client",
"start": "node server.js",
"server": "nodemon server.js",
"client": "npm start --prefix client",
"dev": "concurrently \"npm run server\" \"npm run client\""
},
"author": "",
"license": "ISC",
"dependencies": {
"bcryptjs": "^2.4.3",
"body-parser": "^1.19.0",
"concurrently": "^5.1.0",
"express": "^4.17.1",
"is-empty": "^1.2.0",
"jsonwebtoken": "^8.5.1",
"mongoose": "^5.9.10",
"passport": "^0.4.1",
"passport-jwt": "^4.0.0",
"validator": "^13.0.0"
},
"devDependencies": {
"nodemon": "^2.0.3"
}
}
And here's my client package.json :
{
"name": "client",
"version": "0.1.0",
"private": true,
"dependencies": {
"#testing-library/jest-dom": "^4.2.4",
"#testing-library/react": "^9.5.0",
"#testing-library/user-event": "^7.2.1",
"axios": "^0.19.2",
"classnames": "^2.2.6",
"jwt-decode": "^2.2.0",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-redux": "^7.2.0",
"react-router-dom": "^5.1.2",
"react-scripts": "3.4.1",
"redux": "^4.0.5",
"redux-thunk": "^2.3.0"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"proxy": "http://localhost:5000",
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
I've tried many things and, the most surprising thing is : it works on the computer of my friend but not mines.
Please someone can help me? :)
EDIT : Node version : 13.0.0
EDIT : Found the solution. I "just" had a variable "C:\Windows\System32" in the environment variables :)
I was facing the same problem.
for this code works, you can try this.. on your root package.json
"scripts": {
"start": "node index",
"server": "nodemon index",
"client": "npm run start --prefix client",
"dev": "concurrently \"npm run server\" \"cd client && npm start\""
},
and then from root directory type npm run dev
The node_modules are not compatible with your current systems. You may remove the node_modules folders at the root level AS WELL AS at the client level. Then you install both node_modules AGAIN.
I'm following this tutorials for my first TDD project: https://medium.com/developer-circles-lusaka/how-to-write-an-express-js-server-using-test-driven-development-921dc55aec07
I have install all the required dependency and my package.json file looks like below.
{
"name": "lms_webapi",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"build": "babel src -d dist --source-maps",
"serve": "NODE_ENV=production node dist/index.js",
"start": "NODE_ENV=development babel-node src/index.js",
"dev": "DEBUG=server:debug NODE_ENV=development nodemon src/index.js --exec babel-node",
"test": "DEBUG=server:debug NODE_ENV=test mocha --require babel-core/register --reporter spec --exit tests/ --exec babel-node",
"test:watch": "DEBUG=server:debug NODE_ENV=development mocha --require babel-core/register --watch --reporter spec tests/ --exec babel-node",
"eslint": "eslint src/**/*.js --ignore-pattern \"node_modules/\""
},
"author": "",
"license": "ISC",
"dependencies": {
"babel-cli": "^6.26.0",
"babel-preset-node8": "^1.2.0",
"chai": "^4.2.0",
"config": "^3.3.1",
"debug": "^4.1.1",
"express": "^4.17.1",
"mocha": "^7.1.1",
"mongoose": "^5.9.7",
"supertest": "^4.0.2"
},
"babel": {
"presets": [
"node8"
]
},
"engines": {
"node": ">=8"
},
"eslintConfig": {
"plugins": [
"node"
],
"extends": [
"eslint:recommended",
"plugin:node/recommended"
],
"rules": {
"node/no-unsupported-features/es-syntax": 0,
"node/no-unsupported-features/es-builtins": 0
},
"env": {
"node": true,
"es6": true
},
"parserOptions": {
"sourceType": "module",
"ecmaVersion": 2018
}
}
}
after running the command npm run dev from terminal, I got the following error.
lms_webapi#1.0.0 dev E:\Test\LMS_WebAPI
DEBUG=server:debug NODE_ENV=development nodemon src/index.js --exec babel-node
Der command "DEBUG" is either false or not found.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! lms_webapi#1.0.0 dev: DEBUG=server:debug NODE_ENV=development nodemon src/index.js --exec babel-node
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the lms_webapi#1.0.0 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Your help will be highly appreciated.
Thank you!
The dev-script fails because it tries to look for the DEBUG command instead of setting the environment variable. This tells us that you're probably on a windows machine. Hence, you need can adjust setting the env-variables as follows:
...
"scripts": {
...
"dev": "set DEBUG=server:debug && set NODE_ENV=development && nodemon src/index.js --exec babel-node",
},
...
"npm run react-dev" command gives this jsonparse error occurs repeatedly.
npm ERR! code EJSONPARSE
npm ERR! Failed to parse json
npm ERR! Unexpected token in JSON at position 595 while parsing ' {
npm ERR! "name": "reactnodetutorial",
npm ERR! "vers'
Tried the following but none worked.
1) deleted all directories and files and restarted this project from the scratch like building architecture and installing dependencies
2) deleted all contents in package.json file and copied the tutorial example's package.json contents which is perfect and pasted it to mine
3) update node and npm to the latest version
4) npm init and reinstall dependencies
5) npm cache clean --force
6) rm -f package-lock.json
How to possibly fix this.
My package.json file is as follows:
{
"name": "reactnodetutorial",
"version": "1.0.0",
"description": "",
"main": "webpack.config.js",
"dependencies": {
"babel-core": "^6.26.0",
"babel-loader": "^7.1.4",
"babel-preset-es2015": "^6.24.1",
"babel-preset-react": "^6.24.1",
"body-parser": "^1.18.2",
"express": "^4.16.3",
"react": "^16.2.0",
"react-dom": "^16.2.0",
"react-router": "^4.2.0",
"react-router-dom": "^4.2.2",
"webpack": "^4.1.1"
},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"dev": "webpack -d --watch",
"start": "node ./server/index.js",
"build": "webpack -p",
"react-dev": "webpack -d --watch",
"server-dev": "nodemon server/index.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/shinjehere/reactNodeTutorial.git"
},
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/shinjehere/reactNodeTutorial/issues"
},
"homepage": "https://github.com/shinjehere/reactNodeTutorial#readme"
}
{
"name": "nodej",
"version": "1.0.0",
"description": "",
"main": "index.js.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"start":"node index"
},
"author": "",
"license": "ISC"
}
when i type npm start i get these errors:
C:\Users\User\Documents\nodejs\nodej>npm start
npm ERR! file C:\Users\User\Documents\nodejs\nodej\package.json
npm ERR! code EJSONPARSE
npm ERR! Failed to parse json
npm ERR! Unexpected string in JSON at position 166 while parsing '{
npm ERR! "name": "nodej",
npm ERR! "version": "1.0.0'
npm ERR! File: C:\Users\User\Documents\nodejs\nodej\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
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\User\AppData\Roaming\npm-cache_logs\2017-12-
10T17_30_24_632Z-debug.log
You need to add a comma after the test script:
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1", <-- COMMA HERE
"start":"node index"
},
{
"name": "nodej",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "node index.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}