Search code examples
node.jslaravelnpmhomestead

Fresh Laravel Homestead 8.0.1: npm run dev fails to compile and npm ci fails to install. Something with cross-env?


I recently upgraded my Homestead from 6.3 to fresh Laravel Homestead 8.1.

I ssh'ed into the VM as usual to compile assets in my Laravel project via npm run dev and it started failing.

I was getting issue that Node Sass does not yet support your current environment (similar to this) but running:

sudo npm rebuild node-sass and npm uninstall --save node-sass and npm install --save node-sass didn't help.

When I completely remove node_modules via rm -rf node_modules or do npm ci it install stuff and fails at the end with:

enter image description here

No idea how to fix this. My node and npm versions are below:

node -v gives v12.7.0

npm -v gives 6.10.2

package.json is:

{
  "private": true,
  "scripts": {
    "dev": "npm run development",
    "development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
    "watch": "npm run development -- --watch",
    "watch-poll": "npm run watch -- --watch-poll",
    "hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
    "prod": "npm run production",
    "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
    "test": "cross-env NODE_ENV=test jest",
    "tdd": "npm run test -- --watch --notify"
  },
  "devDependencies": {
    "@coreui/coreui": "^2.0.4",
    "@fortawesome/fontawesome-svg-core": "^1.2.2",
    "@fortawesome/free-brands-svg-icons": "^5.2.0",
    "@fortawesome/free-regular-svg-icons": "^5.2.0",
    "@fortawesome/free-solid-svg-icons": "^5.2.0",
    "@vue/test-utils": "^1.0.0-beta.10",
    "axios": "^0.18",
    "babel-jest": "^22.1.0",
    "bootstrap": "^4.0.0",
    "cross-env": "^5.1",
    "jest": "^22.1.4",
    "jest-vue-preprocessor": "^1.3.1",
    "jquery": "^3.2",
    "laravel-mix": "^2.0",
    "lodash": "^4.17.5",
    "pace": "github:HubSpot/pace#v1.0.2",
    "perfect-scrollbar": "^1.4.0",
    "popper.js": "^1.12.4",
    "sweetalert2": "^7.0.7",
    "vue": "^2.5.7"
  },
  "jest": {
    "testURL": "http://localhost",
    "roots": [
      "<rootDir>/tests/Javascript/"
    ],
    "moduleNameMapper": {
      "^vue$": "vue/dist/vue.common.js"
    },
    "moduleFileExtensions": [
      "js",
      "vue"
    ],
    "transform": {
      "^.+\\.js$": "<rootDir>/node_modules/babel-jest",
      ".*\\.(vue)$": "<rootDir>/node_modules/jest-vue-preprocessor"
    }
  },
  "dependencies": {
    "bootstrap-datepicker": "^1.8.0",
    "clipboard": "^2.0.4",
    "datatables.net": "^1.10.19",
    "datatables.net-bs4": "^1.10.19",
    "datatables.net-scroller": "^2.0.0",
    "debounce": "^1.2.0",
    "jquery-datatables-checkboxes": "^1.2.11",
    "owl.carousel": "^2.3.4",
    "select2": "^4.0.6-rc.1"
  }
}

Can somebody give me any hint? I'm happy to provide additional output from any logs if needed. I'm blocked by this one.


Solution

  • Full reset did the job:

    rm -rf node_modules
    rm package-lock.json
    npm cache clear --force
    npm install
    

    then

    npm run dev

    enter image description here

    I committed new package-lock.json into the repository. Can somebody at least explain what was the culprit?