首页 > 解决方案 > 找不到模块:错误:无法解析“/var/www/html/proj/resources/js”中的“./components/AllPost.vue”

问题描述

Laravel 8.21 使用 npm 更新了所有 node_modules 当我执行 npm run watch 时

I get below error:
user@user-HVM-domU:/var/www/html/proj$ sudo npm run watch

> watch
> mix watch

glob error [Error: EACCES: permission denied, scandir '/root/.npm/_logs'] {
  errno: -13,
  code: 'EACCES',
  syscall: 'scandir',
  path: '/root/.npm/_logs'
}
ERROR in ./resources/js/routes.js 1:0-48
Module not found: Error: Can't resolve './components/AllPost.vue' in '/var/www/html/ginvoice/resources/js'

ERROR in ./resources/js/routes.js 2:0-47
Module not found: Error: Can't resolve './components/AddPost.vue' in '/var/www/html/ginvoice/resources/js'

ERROR in ./resources/js/routes.js 3:0-49
Module not found: Error: Can't resolve './components/EditPost.vue' in '/var/www/html/ginvoice/resources/js'

ERROR in /js/app
Module not found: Error: Can't resolve '/var/www/html/ginvoice/resources/sass/app.scss' in '/var/www/html/ginvoice'

webpack compiled with 4 errors
  1. 须藤纳米包.json
{
    "private": true,
    "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"
    },
    "devDependencies": {
        "axios": "^0.21",
        "laravel-mix": "^6.0.9",
        "lodash": "^4.17.19",
        "postcss": "^8.1.14",
        "resolve-url-loader": "^3.1.0",
        "sass": "^1.32.2",
        "sass-loader": "^8.0.2",
        "vue-loader": "^15.9.6",
        "vue-template-compiler": "^2.6.12"
    },
    "dependencies": {
        "@fortawesome/fontawesome-svg-core": "^1.2.32",
        "@fortawesome/free-solid-svg-icons": "^5.15.1",
        "@fortawesome/vue-fontawesome": "^2.0.2",
        "bootstrap": "^4.5.3",
        "bootstrap-vue": "^2.21.2",
        "cross-env": "^7.0.3",
        "jquery": "^3.5.1",
        "moment": "^2.29.1",
        "npm-check-updates": "^10.2.5",
        "pdfmake": "^0.1.69",
        "popper.js": "^1.16.1",
        "vue": "^2.6.12",
        "vue-axios": "^3.2.2",
        "vue-progressbar": "^0.7.5",
        "vue-router": "^3.4.9"
    }
}

标签: javascriptnode.jsvue.jswebpack

解决方案


推荐阅读