'Why does this error happen? "npm run dev missing script error"
I've been trying to follow the following tutorial: https://github.com/digitsensitive/phaser3-typescript/blob/master/README.md
These are the steps that I had to follow
Prerequisites Download and install npm with Node.js @ https://nodejs.org/en Installing Select a folder, navigate to it, and clone this repository with this command-line:
git clone https://github.com/digitsensitive/phaser3-typescript.git
Install the dependencies with this command-line:
npm install
If you use yarn just replace npm with yarn
Building and Running Perform a quick build (bundle.js) and start server: npm run dev
I've never used node.js and npm before so I'm stumbling across some newbie mistakes. One error I get is that when I try to run npm run dev, Git bash returns the following error code:
npm ERR! missing script: dev
0 info it worked if it ends with ok
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 'run',
1 verbose cli 'dev' ]
2 info using [email protected]
3 info using [email protected]
4 verbose stack Error: missing script: dev
4 verbose stack at run (C:\Program Files\nodejs\node_modules\npm\lib\run-script.js:155:19)
4 verbose stack at C:\Program Files\nodejs\node_modules\npm\lib\run-script.js:63:5
4 verbose stack at C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:115:5
4 verbose stack at C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:418:5
4 verbose stack at checkBinReferences_ (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:373:45)
4 verbose stack at final (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:416:3)
4 verbose stack at then (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:160:5)
4 verbose stack at ReadFileContext. (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:332:20)
4 verbose stack at ReadFileContext.callback (C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\graceful-fs.js:78:16)
4 verbose stack at FSReqWrap.readFileAfterOpen [as oncomplete] (fs.js:237:13)
5 verbose cwd C:\Users\Yassi\TEST
6 verbose Windows_NT 10.0.17134
I don't know what I should be adding to my package.json file to make this work. Could anyone help me with this please?
I made a package.json using init, but the tutorial doesn't state that I have to do this. I don't know why I should manually make a package.json file in the first place.
Solution 1:[1]
Just add div in scripts object in your package.json file
as you see
"scripts": {
"start": "node ./bin/www",
"dev": "nodemon ./bin/www"
},
that's if you use nodemon package
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
