我尝试将Nuxt项目文件夹部署到Heroku,但始终收到此错误。该项目的主要设置是Laravel和NuxtJS的组合,我正在使用此样板https://github.com/cretueusebiu/laravel-nuxt
这是构建日志的样子:
ERROR in ./.nuxt/App.js
Module not found: Error: Can't resolve 'sass-loader' in '/tmp/build_3edb4cd6b283c552d7684236bf31a7e7'
@ ./.nuxt/App.js 11:0-40
@ ./.nuxt/index.js
@ ./.nuxt/client.js
@ multi ./.nuxt/client.js
ERROR in ./client/layouts/admin.vue
Module not found: Error: Can't resolve 'sass-loader' in '/tmp/build_3edb4cd6b283c552d7684236bf31a7e7'
@ ./client/layouts/admin.vue 4:0-66
@ ./.nuxt/App.js
@ ./.nuxt/index.js
@ ./.nuxt/client.js
@ multi ./.nuxt/client.js
在我的本地计算机上,npm run build
可以正常工作。但是当我执行git push heroku master
时,出现此错误。
这是我的 package.json 的样子:
{
"private": true,
"engines": {
"node": "10.x",
"npm": "6.x"
},
"scripts": {
"dev": "nuxt -c client/nuxt.config.js",
"build": "nuxt build -c client/nuxt.config.js",
"start": "nuxt start -c client/nuxt.config.js",
"lint": "eslint --fix --ext .js,.vue client/"
},
"dependencies": {
"@coreui/coreui": "^3.2.2",
"@fortawesome/fontawesome-svg-core": "^1.2.26",
"@fortawesome/free-brands-svg-icons": "^5.12.0",
"@fortawesome/free-regular-svg-icons": "^5.12.0",
"@fortawesome/free-solid-svg-icons": "^5.12.0",
"@fortawesome/vue-fontawesome": "^0.1.9",
"@nuxtjs/router": "^1.5.0",
"axios": "^0.19.1",
"bootstrap": "^4.4.1",
"dotenv": "^8.2.0",
"font-awesome": "^4.7.0",
"jquery": "^3.5.1",
"js-cookie": "^2.2.1",
"nuxt": "^2.11.0",
"popper.js": "^1.16.0",
"sweetalert2": "^8.19.0",
"vform": "^1.0.1",
"vue-i18n": "^8.15.3"
},
"devDependencies": {
"@fortawesome/fontawesome-free": "^5.13.1",
"@nuxtjs/eslint-config": "^1.1.2",
"babel-eslint": "^10.0.3",
"eslint": "^6.8.0",
"fs-extra": "^8.1.0",
"node-sass": "^4.14.1",
"pug": "^3.0.0",
"pug-plain-loader": "^1.0.0",
"sass-loader": "^7.3.1",
"sass-resources-loader": "^2.0.3"
}
}