Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

warpig's avatar
Level 12

Npm run build not found

Im trying to runnpm run build but I get an error:

λ npm run build 
npm ERR! missing script: build

These are the scripts inside of package.json and guess what, no "build",

    "scripts": {
        "dev": "npm run development",
        "development": "mix",
        "watch": "mix watch",
        "watch-poll": "mix watch -- --watch-options-poll=1000",
        "hot": "mix watch --hot",
        "prod": "npm run production",
        "production": "mix --production"
    },

According to this question: https://stackoverflow.com/questions/61516683/npm-run-build-missing-script , that is where you set it up but I just wanted to be 100% sure because I sincerely don't know how that stuff works and I don't want to break or mis-configure something I won't be able to repair later. Thanks!

PLUS: In the question that person uses some files im not familiar with, for example "app.tsx":

"build": "webpack-cli app.tsx --config webpack-config.js"

0 likes
20 replies
sr57's avatar

If you don't have the build script you should not need it.

What package did you installed taht ask u run this cde?

Maybe npm audit or doctor can give you some trick if st worked false before ...

warpig's avatar
Level 12

Oh, im using Laragon yeah I did ran that command.

sr57's avatar

I don't work with Laragon but I suppose it does not change the way of installing package ...

warpig's avatar
Level 12

This is the error log:

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   'C:\laragon\bin\nodejs\node-v12\node.exe',
1 verbose cli   'C:\laragon\bin\nodejs\node-v12\node_modules\npm\bin\npm-cli.js',
1 verbose cli   'run',
1 verbose cli   'build'
1 verbose cli ]
2 info using [email protected]
3 info using [email protected]
4 verbose stack Error: missing script: build
4 verbose stack     at run (C:\laragon\bin\nodejs\node-v12\node_modules\npm\lib\run-script.js:155:19)
4 verbose stack     at C:\laragon\bin\nodejs\node-v12\node_modules\npm\lib\run-script.js:63:5
4 verbose stack     at C:\laragon\bin\nodejs\node-v12\node_modules\npm\node_modules\read-package-json\read-json.js:115:5
4 verbose stack     at C:\laragon\bin\nodejs\node-v12\node_modules\npm\node_modules\read-package-json\read-json.js:418:5
4 verbose stack     at checkBinReferences_ (C:\laragon\bin\nodejs\node-v12\node_modules\npm\node_modules\read-package-json\read-json.js:373:45)
4 verbose stack     at final (C:\laragon\bin\nodejs\node-v12\node_modules\npm\node_modules\read-package-json\read-json.js:416:3)
4 verbose stack     at then (C:\laragon\bin\nodejs\node-v12\node_modules\npm\node_modules\read-package-json\read-json.js:160:5)
4 verbose stack     at C:\laragon\bin\nodejs\node-v12\node_modules\npm\node_modules\read-package-json\read-json.js:364:12
4 verbose stack     at C:\laragon\bin\nodejs\node-v12\node_modules\npm\node_modules\graceful-fs\graceful-fs.js:90:16
4 verbose stack     at FSReqCallback.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:61:3)
5 verbose cwd C:\laragon\www\videotheque
6 verbose Windows_NT 10.0.19042
7 verbose argv "C:\laragon\bin\nodejs\node-v12\node.exe" "C:\laragon\bin\nodejs\node-v12\node_modules\npm\bin\npm-cli.js" "run" "build"
8 verbose node v12.5.0
9 verbose npm  v6.9.0
10 error missing script: build
11 verbose exit [ 1, true ]

EDIT: Not sure if I have npm-cli installed... is that needed?

sr57's avatar

What's the command you did?

jagged_little_phil's avatar
Level 3

I'm not familiar with Laragon, but it looks like it's using node version 12... Node is currently using 14.16.1 as it's current LTS.

Could it be that the Laragon version you are using may need to be updated to a newer version?

...

Also, build is usually tied to a webpack config file. Are you using React or something that needs to have a build process with webpack/babel or something?

App.tsx is a TypeScript file. It's generally the entry point to a single page app that is built with something like React and written with TypeScript instead of regular JavaScript.

warpig's avatar
Level 12

I can try that as well, would make sense, when I first installed Laragon it was running on a 7.2 version of PHP luckily it was not difficult to perform an update. Thanks @phillipkregg

@sr57 the command I did was npm run build this is the complete log, since I already had googled the problem I found that somebody on StackOverflow had the same issue, so I didn't published the full error, figured it would be a matter of adding a "build" line on the package.json but anyway, enough chit-chat, this is the full error I get:

λ npm run build
npm ERR! missing script: build

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\USER\AppData\Roaming\npm-cache\_logs21-04-12T19_47_59_965Z-debug.log
sr57's avatar

We come back to the beginning , you don't have build, ... don't add it.

You never answer where do u read to run this cde? (as @phillipkregg wrote It should be linked to st else)

warpig's avatar
Level 12

Where did I ran this code, it was on the Laragon terminal @sr57 which is where I run all of my Laravel commands.

sr57's avatar

The question is "Why do you run this command?" - communication is always a dificult art :-)

warpig's avatar
Level 12

Ah, ok.. I ran npm run build because Video.js has an extension which is installed through NPM so heres that extension: https://github.com/videojs/videojs-youtube and on the installation set up this reads:

You can use bower (bower install videojs-youtube), npm (npm install videojs-youtube) or the source and build it using npm run build. Then, the only file you need is dist/Youtube.min.js.

If I understand correctly, I should do this:

  1. npm install videojs-youtube
  2. npm run build

Of course I think you have to run: npm install --save-dev video.js, first in order to have the extension working. https://videojs.com/getting-started

sr57's avatar

We got the st else :-)

npm install videojs-youtube OR ...

nmp install is enough to install the package

2 likes
jagged_little_phil's avatar

Ok, according to the instructions, the command npm run build can be used to build the source for videojs-youtube locally... but, you don't have to do that.

Just install it with npm install videojs-youtube

warpig's avatar
Level 12

Also, build is usually tied to a webpack config file. Are you using React or something that needs to have a build process with webpack/babel or something? App.tsx is a TypeScript file. It's generally the entry point to a single page app that is built with something like React and written with TypeScript instead of regular JavaScript.

@phillipkregg From that answer, I got the impression that I would only need to add a new "build" command in that file but I just wasn't sure and I did not trusted the solution enough on that answer because that person was indeed using something like Netlify, so I preferred to ask here before comiting to it. Im not using React, it's a Laravel 8 project.

jagged_little_phil's avatar

If you don't have any type of webpack configuration setup, then it's probably better to just use the "Quick Start" guide in the video players docs.

<link href="//vjs.zencdn.net/7.10.2/video-js.min.css" rel="stylesheet">
<script src="//vjs.zencdn.net/7.10.2/video.min.js"></script>

Just adding that will get you access to the video player's API.

If this is a Laravel 8 app, you should be able to just add the NPM package to your devDependencies and run:

npm run dev

You shouldn't need npm run build

1 like
warpig's avatar
Level 12

@phillipkregg as you mentioned:

Error: You are using an unsupported version of Node. Please update to at least Node v12.14

So I will try that and see what happens, also does this mean I don't need to install the Youtube extension from the NPM? Since it comes with it's own files, I think I should still reference them on my views, and that should still work, right?

Please or to participate in this conversation.