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

09cody's avatar

Npm Run Dev Dependency Not Found (bootstrap/dist/js/npm)

I'm having an absolutely terrible time trying to get my first Laravel project off the ground.

Whenever I run "npm run dev" I'm met with the following error:

ERROR  Failed to compile with 1 errors                                                                            

This dependency was not found:

* bootstrap/dist/js/npm in ./vendor/laravel/spark/resources/assets/js/spark-bootstrap.js

To install it, you can run: npm install --save bootstrap/dist/js/npm 

However, when I run the npm install command that it tell me to:

npm ERR! Could not install from "bootstrap/dist/js/npm" as it does not contain a package.json file.

My packages.json file:

{
  "private": true,
  "scripts": {
    "dev": "node node_modules/webpack/bin/webpack.js --progress --hide-modules --config=$npm_package_config_webpack",
    "watch": "npm run dev -- -w",
    "watch-poll": "npm run dev -- -w --watch-poll",
    "hot": "node node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=$npm_package_config_webpack",
    "production": "npm run dev -- -p"
  },
  "config": {
    "webpack": "node_modules/laravel-mix/setup/webpack.config.js"
  },
  "devDependencies": {
    "axios": "^0.15.3",
    "bootstrap-sass": "^3.3.7",
    "jquery": "^3.1.1",
    "laravel-mix": "^0.8.1",
    "lodash": "^4.17.4",
    "vue": "^2.1.10"
  },
  "dependencies": {
    "js-cookie": "^2.1.4",
    "moment": "^2.18.1",
    "urijs": "^1.18.10"
  }
}

I've lost two full days of my life fighting npm run, sorting through forums and reading documentation to absolutely no avail. I've ran npm install more than I can count, with and without --no-bin-links, and cleared my cache over and over. I've updated npm to the latest version (5.0.3) and deleted my entire Homestead setup twice and started from scratch. Occasionally I will get it to run, but I always end up back here. I simply don't know what it wrong or what I need to do.

If anyone could possibly point me in the right direction, I'd be eternally grateful.

0 likes
4 replies
azimidev's avatar

it's your bootstrap and webpack config file

path.resolve(__dirname, 'vendor/laravel/spark/resources/assets/js'),
JuanDBB's avatar

Hello, How did you resolve it please?

tjefford's avatar

Spent a couple hours with this today, for me it was a conflict of bootstrap 3 and 4.

The fix, was to edit the spark-bootstrap file provided by a plain spark installation.

This assumes you are using bootstrap4 via npm installation.

Around line 42

spark/resources/assets/js/spark-bootstrap.js

Change this: require('bootstrap/dist/js/npm');

To this: require('bootstrap');

joshuaf's avatar

Don't know how you worked this out, but it appears to have worked for me as well

Please or to participate in this conversation.