ottaviane's avatar

npm run watch doesn't works after upgrade

Hi all, tomorrow after a 'npm i vuex --save' a obtain a new problem and I can't work at my project: when I run 'npm run watch' I obtain this:

 npm run watch

> watch
> mix watch

sh: 1: mix: not found
npm ERR! code 127
npm ERR! path /home/ottaviane/Sviluppo/SquadrarioWeb
npm ERR! command failed
npm ERR! command sh -c mix watch

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/ottaviane/.npm/_logs/2022-01-14T13_51_28_815Z-debug.log

and after a lot of npm upgrade and update I obtained nothing. The log is:

23 verbose cwd /home/ottaviane/Sviluppo/SquadrarioWeb
24 verbose Linux 5.13.0-25-generic
25 verbose argv "/usr/bin/node" "/usr/bin/npm" "run" "watch"
26 verbose node v12.22.5
27 verbose npm  v7.5.2
28 error code 127
29 error path /home/ottaviane/Sviluppo/SquadrarioWeb
30 error command failed
31 error command sh -c mix watch
32 verbose exit 127

Can you help me please???? Bye

0 likes
17 replies
ottaviane's avatar
{
    "private": true,
    "scripts": {
        "development": "mix",
        "watch": "mix watch",
        "watch-poll": "mix watch -- --watch-options-poll=1000",
        "hot": "mix watch --hot",
        "prod": "mix --production",
        "production": "mix --production"
    },
    "devDependencies": {
        "axios": "^0.21.1",
        "bootstrap": "^4.6.0",
        "browser-sync": "^2.26.14",
        "browser-sync-webpack-plugin": "^2.3.0",
        "cross-env": "^7.0",
        "jquery": "^3.6.0",
        "jquery-scroll-lock": "^3.1.3",
        "jquery.appear": "^1.0.1",
        "js-cookie": "^2.2.1",
        "lodash": "^4.17.19",
        "popper.js": "^1.16.1",
        "postcss": "^8.2.12",
        "resolve-url-loader": "^2.3.2",
        "sass": "^1.32.8",
        "sass-loader": "^12.4.0",
        "simplebar": "^5.3.0",
        "vue": "^2.6.12",
        "vue-loader": "^17.0.0",
        "vue-template-compiler": "^2.6.12"
    },
    "dependencies": {
        "asap": "^2.0.6",
        "codemirror": "^5.60.0",
        "core-js": "^3.20.2",
        "css-loader": "^5",
        "dedent": "^0.7.0",
        "html-to-image": "^1.9.0",
        "svgo": "^2.8.0",
        "tiptap": "^1.32.2",
        "tiptap-extensions": "^1.35.2",
        "uuid": "^7.0.3",
        "vue-codemirror": "^4.0.6",
        "vue-loading-button": "^0.2.0",
        "vuex": "^3.6.2",
        "webpack": "^5.66.0",
        "webpack-dev-server": "^4.7.3"
    }
}
ottaviane's avatar

@Sinnbeck Thank you very mutch. So I made all, I installe laravel-mix but when I do :'npx mix' I obtain

npx mix
[webpack-cli] Error: Cannot find module 'vue/compiler-sfc'
Require stack:
- /home/ottaviane/Sviluppo/SquadrarioWeb/node_modules/vue-loader/dist/index.js
- /home/ottaviane/Sviluppo/SquadrarioWeb/node_modules/laravel-mix/src/components/Vue.js
- /home/ottaviane/Sviluppo/SquadrarioWeb/node_modules/laravel-mix/src/components/ComponentRegistrar.js
- /home/ottaviane/Sviluppo/SquadrarioWeb/node_modules/laravel-mix/src/Mix.js
- /home/ottaviane/Sviluppo/SquadrarioWeb/node_modules/laravel-mix/setup/webpack.config.js
- /home/ottaviane/Sviluppo/SquadrarioWeb/node_modules/webpack-cli/lib/webpack-cli.js
- /home/ottaviane/Sviluppo/SquadrarioWeb/node_modules/webpack-cli/lib/bootstrap.js
- /home/ottaviane/Sviluppo/SquadrarioWeb/node_modules/webpack-cli/bin/cli.js
- /home/ottaviane/Sviluppo/SquadrarioWeb/node_modules/webpack/bin/webpack.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
    at Function.Module._load (internal/modules/cjs/loader.js:667:27)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/home/ottaviane/Sviluppo/SquadrarioWeb/node_modules/vue-loader/dist/index.js:8:24)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Module.require (internal/modules/cjs/loader.js:887:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/home/ottaviane/Sviluppo/SquadrarioWeb/node_modules/vue-loader/dist/index.js',
    '/home/ottaviane/Sviluppo/SquadrarioWeb/node_modules/laravel-mix/src/components/Vue.js',
    '/home/ottaviane/Sviluppo/SquadrarioWeb/node_modules/laravel-mix/src/components/ComponentRegistrar.js',
    '/home/ottaviane/Sviluppo/SquadrarioWeb/node_modules/laravel-mix/src/Mix.js',
    '/home/ottaviane/Sviluppo/SquadrarioWeb/node_modules/laravel-mix/setup/webpack.config.js',
    '/home/ottaviane/Sviluppo/SquadrarioWeb/node_modules/webpack-cli/lib/webpack-cli.js',
    '/home/ottaviane/Sviluppo/SquadrarioWeb/node_modules/webpack-cli/lib/bootstrap.js',
    '/home/ottaviane/Sviluppo/SquadrarioWeb/node_modules/webpack-cli/bin/cli.js',
    '/home/ottaviane/Sviluppo/SquadrarioWeb/node_modules/webpack/bin/webpack.js'
  ]
}

And I tryed also 'npm i @vue/compiler-sfc' but it doesn't work

Sinnbeck's avatar

@ottaviane Maybe undo your changes with git, and see how the package.json was before you started upgrading?

Sinnbeck's avatar

@ottaviane Ok. Do you have a backup of the file on your production server? Or another computer?

ottaviane's avatar

@Sinnbeck ok. what files? The entire project? or only some files? can you specify please? thank you very mutch

ottaviane's avatar

@Sinnbeck ok. Excuse me. This is my old package.json that worked for me yesterday:

{
    "private": true,
    "scripts": {
        "development": "mix",
        "watch": "mix watch",
        "watch-poll": "mix watch -- --watch-options-poll=1000",
        "hot": "mix watch --hot",
        "prod": "mix --production",
        "production": "mix --production"
    },
    "devDependencies": {
        "axios": "^0.21.1",
        "bootstrap": "^4.6.0",
        "browser-sync": "^2.26.14",
        "browser-sync-webpack-plugin": "^2.3.0",
        "cross-env": "^7.0",
        "jquery": "^3.6.0",
        "jquery-scroll-lock": "^3.1.3",
        "jquery.appear": "^1.0.1",
        "js-cookie": "^2.2.1",
        "laravel-mix": "^6.0.18",
        "lodash": "^4.17.19",
        "popper.js": "^1.16.1",
        "postcss": "^8.2.12",
        "resolve-url-loader": "^3.1.2",
        "sass": "^1.32.8",
        "sass-loader": "^8.0.2",
        "simplebar": "^5.3.0",
        "vue": "^2.6.12",
        "vue-loader": "^15.9.6",
        "vue-template-compiler": "^2.6.12"
    },
    "dependencies": {
        "codemirror": "^5.60.0",
        "dedent": "^0.7.0",
        "html-to-image": "^1.9.0",
        "tiptap": "^1.32.2",
        "tiptap-extensions": "^1.35.2",
        "vue-codemirror": "^4.0.6",
        "vue-loading-button": "^0.2.0",
        "vuex": "^3.6.2"
    }
}
ottaviane's avatar

is it a good idea to reinstall entire npm and vue and mix packages? what is the right method preservating my project?

Please or to participate in this conversation.