javascript - 找不到模块:错误:无法解析“/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
我的 sudo nano 资源/js/routes.js
从'./components/AllPost.vue'导入AllPosts;从'./components/AddPost.vue'导入AddPost;从'./components/EditPost.vue'导入EditPost;
export const routes = [ { name: 'home', path: '/', component: AllPosts }, { name: 'add', path: '/add', component: AddPost }, { name: 'edit', path : '/edit/:id', 组件: EditPost } ];
- 须藤纳米包.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" } }
解决方案
推荐阅读
- .net - 无法发布到 Git 中心,发布到 GitHub 选项在 VS 2019 中不可用
- c# - 如何转换反射接收到的类型?
- java - 用空格区分空文本节点和文本节点
- excel - 如何从dll访问excel中的单元格
- google-apps-script - 主表上两个单独的表的双向同步
- c# - 如何在 .NET Core 3.1 中访问和审核文件的安全性
- android - 如何在 Android Studio 中制作 JNI hello world 程序?
- python - 如何在不声明全局的情况下访问单独的 Python 文件中函数的多个变量?
- mysql - 使用存储过程在商店捆绑系统中一一选择多行(重复直到一定数量)
- mysql - Laravel - 雄辩的查询没有给出预期的结果