Installing NPM - missing script: start - npm

I'm currently having problems starting NPM. I've installed along with Node.JS.
When I Run 'npm start' via Command Prompt I recieve the following ...
C:\Users\bobbyy>npm start
npm ERR! missing script: start
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\bobby\AppData\Roaming\npm-cache_logs\2017-03-29T21_36_56_974Z-debug.log
Can someone please advise what should be in 'package.json' start?

Write a code in package.json file as below
"scripts": {
"start": "node your-script.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
Copied from github forum
Hope It works for you.

Related

I am facing "npm run dev" missing script issues. How to resolve it?

I am currently in the folder E:\Learn\app-code-vue
E:\Learn\app-code-vue>npm run dev
npm ERR! Missing script: "dev"
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! C:\Users\Shrikant Rana\AppData\Local\npm-cache\_logs\2022-01-24T14_
26_36_332Z-debug.log
See the scripts that are configured with Vue CLI 3 in the package.json file
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint" },
so you can run by use this : npm run serve
Check your package.json file and see if you have dev named in your "scripts" key. This is what your package.json script tag should look like if you want to run a dev command:
"scripts": {
"start": "node index.js",
"dev": "concurrently \"npm run server\" \"npm run client\""
},
use npm run serve
It's working for me
You may need to check if you are really in the correct folder

npm install command not working in npm script

Given a package.json that includes the following scripts:
"scripts": {
"dev": "npm install && webpack-dev-server --hot --progress --colors",
"build": "npm install && webpack --env.prod --progress --colors",
"start": "npm run dev"
}
Running npm start gives me many errors of the sort
`npm WARN tar ENOENT: no such file or directory, open 'C:\repos\my-project\node_modules\.staging\core-js-ea8988d1\client\shim.js'
followed by
npm ERR! code 1
npm ERR! Command failed: git submodule update -q --init --recursive
npm ERR! C:/Users/JohnDoe/AppData/Local/Programs/Git/mingw64/libexec/git-core\git-submodule: line 21: .: git-sh-setup: file not found
However, if instead I just run npm install directly, the npm installation of packages succeeds with no errors, and then I can run npm start thereafter with no issues. Why is this? There seems to be some kind of issue with including npm install in an npm script if the packages are not yet installed. I also tried setting start to "npm install" but running npm start gave me the same errors in that case.

I keep getting `errno 4058` from npm

I used npm in the last weeks without any problems, but all of the sudden i keep getting this error:
npm ERR! path J:\Work\Web_server\create_file\node_modules\depd
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall rename
npm ERR! enoent ENOENT: no such file or directory, rename 'J:\Work\Web_server\create_file\node_modules\depd' -> 'J:\Work\Web_server\create_file\node_modules\.depd.DELETE'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\crist\AppData\Roaming\npm-cache\_logs\2018-08-13T09_21_56_509Z-debug.log
This is the package.json:
{
"name": "create_file",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies":{
},
"devDependencies":{
"express": "4.16.3"
}
}
The thing is, it also happens when I manually install a package. What am I doing wrong? Thanks
Edit: And when I tried it on a different directory the manual installation worked. I have no idea why.
I faced the same error on macOS 10.12.6, Node 8.3.0, NPM 5.3.0. It often, but not always is referring to .DELETE. It does always report ENOENT: no such file or directory
There are no other Node processes running. I closed Visual Studio Code, still seeing ENOENT.
QuickFix:
Delete package-lock.json and run NPM again
try this to solve your error
1st check your port is running or not through this command
lsof -i :8080 // <- this is your port whatever you used
the port is cotinuesly run or not if it run then use the below command
kill -9 14528 //your procee Id
then once try to run
node index.js

Difference between npm start and npm run start

I have checked both commands npm start and npm run start, both works perfectly. I used create-react-app. But to make configuration changes in the CSS module, I run npm eject but it throws an error.
But npm run eject worked? I'm confused on why npm eject didn't work. Can I configure this?
Below is my package.json:
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
}
npm test, npm start, npm restart, and npm stop are all aliases for npm run xxx.
For all other scripts you define, you need to use the npm run xxx syntax.
See the docs at https://docs.npmjs.com/cli/run-script for more information.
npm start is the short form for npm run start. So, its one and the same thing.
One interesting thing to note is,
If the scripts object does not have a "start" property in package.json file, npm start or npm run start from command line will run node server.js by default.
But if the scripts object in package.json has "start" property, it overrides node server.js and executes the command in "start" property.
See - https://docs.npmjs.com/cli/v7/commands/npm-start#description
Telling this because sometimes this can be help to someone.
Inside the jenkins pipelines you should use npm commands with "run"
ex- npm run start
if not the command will not be executed.

Eslint and start webpack

I would like to run eslint before webpack start.
I installed parallel and npm-run-all packages but didn't help.
When I type: npm run dev I get:
npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! myproject-ui#1.0.0
eslint: eslint src/ npm ERR! Exit status 1 npm ERR! npm ERR! Failed
at the myproject-ui#1.0.0 eslint script. npm ERR! This is probably not
a problem with npm. There is likely additional logging output above.
My package.json:
"scripts": {
"start": "node ./node_modules/webpack-dev-server/bin/webpack-dev-server.js",
"test": "mocha --compilers js:babel-core/register ./tests/**/*.js",
"test:watch": "npm run test -- --watch",
"code:coverage": "nyc npm run test",
"eslint": "eslint src/",
"dev": "npm-run-all --parallel start eslint"
},
Any idea how to run eslint and webpack parallel?;)
Greetings
It's not elegant solution but works fine
"lint": "eslint src || exit 0",
"dev": "npm-run-all --parallel lint start"
Because link returns exit 1 err so it makes them work parallel even though ;).