简体   繁体   中英

Missing packages after cleaning node_modules

I had an issue: npm run watch was stuck after 10%, so I deleted node_modules directory and package-lock.json But I guess I installed modules with npm install without using --save-dev, and after having reinstalled several of them I still get a warning and can't identify which package is missing here...

WARNING in ./resources/js/components/common/ContenuComponent.vue?vue&type=style&index=0&id=1a3ffd6c&scoped=true&lang=css& (./node_modules/css-loader/dist/cjs.js??ref--6-1!./node_modules/laravel-mix/node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src??ref--6-2!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/common/ContenuComponent.vue?vue&type=style&index=0&id=1a3ffd6c&scoped=true&lang=css&)
Module Warning (from ./node_modules/css-loader/dist/cjs.js):
Warning

(476:2) Unable to find uri in 'background:url() no-repeat top left black'
 @ ./resources/js/components/common/ContenuComponent.vue?vue&type=style&index=0&id=1a3ffd6c&scoped=true&lang=css& (./node_modules/style-loader!./node_modules/css-loader/dist/cjs.js??ref--6-1!./node_modules/laravel-mix/node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src??ref--6-2!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/common/ContenuComponent.vue?vue&type=style&index=0&id=1a3ffd6c&scoped=true&lang=css&) 2:14-388
 @ ./resources/js/components/common/ContenuComponent.vue?vue&type=style&index=0&id=1a3ffd6c&scoped=true&lang=css&
 @ ./resources/js/components/common/ContenuComponent.vue
 @ ./resources/js/app.js
 @ multi ./resources/js/app.js ./resources/sass/app.scss

I did:

  • npm install postcss-loader --save-dev

  • npm install style-loader --save-dev

  • npm install css-loader --save-dev

  • npm install file-loader --save-dev

  • npm install vue-loader --save-dev

    Is there any way to identify what I am missing? Thanks a lot!

when you remove package-lock.json , you remove references about which specific versions of each package were installed before. My guess is that there was an issue published within the css-loader module, which seems to be a dependency of a dependency of Laravel.

The easiest fix would be bringing back package-lock.json , removing node_modules again and reinstalling with npm install .

There are few things you can try based on the information you have provided. You can try npm cache clean or npm cache clean --f (this is a force, which will ask you if you know what you are doing, you can proceed with the force). Once the cache has been cleaned, you can try running npm install again. Also check your version of NodeJS and make sure that whatever packages you're using is also supporting the version. Node -V and check and make sure that css loader supports your version of node.

After I thought it had been fixed, I got the issue again today (worst actually, this time it was an error). So I went back to package-lock.json old version and after many tries and another hours lost, it worked.

I guess this is gonna happen again and obviously I cannot do that because I will add other packages in the future. I am wondering if there is any way to add all missing packages in package.json dev dependencies? I have no idea how to identify them?

It seems like npm install ls node_modules --save was working some years ago, so I m trying to dind something like this but reading in package-lock.json maybe (am I dreaming? :) )

Thanks a lot

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM