You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/javascript/npm.md
+8-2Lines changed: 8 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -60,7 +60,10 @@ See more examples of a `package.json` file in the [npm docs for creating a packa
60
60
In the above example, notice that there are already two scripts in the `scripts` object. npm scripts are just JSON key-value pairs where the key is the name of the script (such as `start`) and the value contains the script you want to execute (such as `node index.js`).
61
61
62
62
```json
63
-
"scripts": { "start": "node index.js", ...}
63
+
"scripts": {
64
+
"start": "node index.js",
65
+
...
66
+
}
64
67
```
65
68
66
69
Being a popular npm script, it can be run like this:
@@ -72,7 +75,10 @@ npm start
72
75
What if you have custom npm scripts such as `start:dev` like in the above example?
73
76
74
77
```json
75
-
"scripts": {... "start:dev": "nodemon index.js" }
78
+
"scripts": {
79
+
...
80
+
"start:dev": "nodemon index.js"
81
+
}
76
82
```
77
83
78
84
Now, npm start:dev would not work because it is a custom npm script. Custom npm scripts must be preceded by either `run-script` or `run` for them to be executed.
0 commit comments