jcc / blog

:star2: PJ Blog is an open source blog built with Laravel and Vue.js.
https://www.pigjian.com
MIT License
2.88k stars 688 forks source link

npm run dev出错、尝试了解决但无果 #87

Closed lenkaren closed 6 years ago

lenkaren commented 6 years ago

命令行输入

npm run dev


cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js

95% emitting m ERROR Failed to compile with 1 errors 08:57:44

This dependency was not found:

To install it, you can run: npm install --save sweetalert Asset Size Chunks Chunk Names js/13.28485d4e24821ebdbb1a.js 12 kB 13 [emitted] js/0.e9cc2f80f5e004bd0dd3.js 871 kB 0 [emitted] [big] js/2.5066ca57ad4947b49930.js 1.18 MB 2 [emitted] [big] js/3.1fd4673ca5a024ef80ed.js 33.1 kB 3 [emitted] js/4.291b9a49882cf5d130c5.js 18.1 kB 4 [emitted] js/5.e583323bca56ebbb9a9e.js 17.6 kB 5 [emitted] js/6.9f3fd49978657722e329.js 302 kB 6 [emitted] [big] js/7.9a9d2f49476b983137cb.js 302 kB 7 [emitted] [big] js/8.22f61d87e848039e06a7.js 14.9 kB 8 [emitted] js/9.e8377f1d8ee372fb60dd.js 14.5 kB 9 [emitted] js/10.26692bc860ebe5c13b25.js 11.6 kB 10 [emitted] js/11.58c9f9e764ac29c56c38.js 11.1 kB 11 [emitted] js/12.197f0b56f6ab2f5394bf.js 280 kB 12 [emitted] [big] js/1.8a459384b71c7d6948fc.js 1.18 MB 1 [emitted] [big] js/14.0d1146ea3fc1b1d0039c.js 11.5 kB 14 [emitted] js/15.17bd360ab69484ab52bc.js 12.1 kB 15 [emitted] js/16.1889d1fc1bcbb8fb2a53.js 5.59 kB 16 [emitted] js/17.a86ff9655f45ba3bcbbe.js 4.99 kB 17 [emitted] js/18.09fe63c219a83c0aa655.js 5.53 kB 18 [emitted] js/19.6ce11b5b659e55ba8257.js 5.79 kB 19 [emitted] js/20.e62463d85e46fcbdd875.js 4.94 kB 20 [emitted] js/21.5b09728a830c755719fb.js 5.01 kB 21 [emitted] js/22.f96a58e52d35fe5ff745.js 5.72 kB 22 [emitted] js/23.ca4777793d63d3dda894.js 4.08 kB 23 [emitted] /js/app.js 1.54 MB 24 [emitted] [big] /js/app /js/home.js 1.93 MB 25 [emitted] [big] /js/home npm ERR! code ELIFECYCLE npm ERR! errno 2 npm ERR! @ development: cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js npm ERR! Exit status 2 npm ERR! npm ERR! Failed at the @ development script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! /Users/Aren/.npm/_logs/2017-12-23T00_57_46_260Z-debug.log npm ERR! code ELIFECYCLE npm ERR! errno 2 npm ERR! @ dev: npm run development npm ERR! Exit status 2 npm ERR! npm ERR! Failed at the @ dev script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.


这里提示是说没有找到sweetalert依赖, 于是我按照提示重新安装

> npm install --save sweetalert

继续报错,这回貌似是没办找到各种文件

cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js

95% emitting m ERROR Failed to compile with 4 errors 08:59:33

error in ./resources/assets/sass/app.scss

Module build failed: @import "node_modules/sweetalert/dev/sweetalert.scss"; ^ File to import not found or unreadable: node_modules/sweetalert/dev/sweetalert.scss. Parent style sheet: /Users/Aren/project/catblog/resources/assets/sass/public.scss in /Users/Aren/project/catblog/resources/assets/sass/public.scss (line 15, column 1)

@ ./resources/assets/sass/app.scss 4:14-266 @ multi ./resources/assets/js/app.js ./resources/assets/sass/app.scss ./resources/assets/sass/home.scss

error in ./resources/assets/sass/home.scss

Module build failed: @import "node_modules/sweetalert/dev/sweetalert.scss"; ^ File to import not found or unreadable: node_modules/sweetalert/dev/sweetalert.scss. Parent style sheet: /Users/Aren/project/catblog/resources/assets/sass/public.scss in /Users/Aren/project/catblog/resources/assets/sass/public.scss (line 15, column 1)

@ ./resources/assets/sass/home.scss 4:14-267 @ multi ./resources/assets/js/app.js ./resources/assets/sass/app.scss ./resources/assets/sass/home.scss

error in ./resources/assets/sass/app.scss

Module build failed: ModuleBuildError: Module build failed: @import "node_modules/sweetalert/dev/sweetalert.scss"; ^ File to import not found or unreadable: node_modules/sweetalert/dev/sweetalert.scss. Parent style sheet: /Users/Aren/project/catblog/resources/assets/sass/public.scss in /Users/Aren/project/catblog/resources/assets/sass/public.scss (line 15, column 1) at runLoaders (/Users/Aren/project/catblog/node_modules/webpack/lib/NormalModule.js:194:19) at /Users/Aren/project/catblog/node_modules/loader-runner/lib/LoaderRunner.js:364:11 at /Users/Aren/project/catblog/node_modules/loader-runner/lib/LoaderRunner.js:230:18 at context.callback (/Users/Aren/project/catblog/node_modules/loader-runner/lib/LoaderRunner.js:111:13) at Object.asyncSassJobQueue.push [as callback] (/Users/Aren/project/catblog/node_modules/sass-loader/lib/loader.js:55:13) at Object. (/Users/Aren/project/catblog/node_modules/async/dist/async.js:2244:31) at Object.callback (/Users/Aren/project/catblog/node_modules/async/dist/async.js:906:16) at options.error (/Users/Aren/project/catblog/node_modules/node-sass/lib/index.js:294:32)

error in ./resources/assets/sass/home.scss

Module build failed: ModuleBuildError: Module build failed: @import "node_modules/sweetalert/dev/sweetalert.scss"; ^ File to import not found or unreadable: node_modules/sweetalert/dev/sweetalert.scss. Parent style sheet: /Users/Aren/project/catblog/resources/assets/sass/public.scss in /Users/Aren/project/catblog/resources/assets/sass/public.scss (line 15, column 1) at runLoaders (/Users/Aren/project/catblog/node_modules/webpack/lib/NormalModule.js:194:19) at /Users/Aren/project/catblog/node_modules/loader-runner/lib/LoaderRunner.js:364:11 at /Users/Aren/project/catblog/node_modules/loader-runner/lib/LoaderRunner.js:230:18 at context.callback (/Users/Aren/project/catblog/node_modules/loader-runner/lib/LoaderRunner.js:111:13) at Object.asyncSassJobQueue.push [as callback] (/Users/Aren/project/catblog/node_modules/sass-loader/lib/loader.js:55:13) at Object. (/Users/Aren/project/catblog/node_modules/async/dist/async.js:2244:31) at Object.callback (/Users/Aren/project/catblog/node_modules/async/dist/async.js:906:16) at options.error (/Users/Aren/project/catblog/node_modules/node-sass/lib/index.js:294:32)

                    Asset     Size  Chunks                    Chunk Names

js/13.28485d4e24821ebdbb1a.js 12 kB 13 [emitted] js/0.e9cc2f80f5e004bd0dd3.js 871 kB 0 [emitted] [big] js/2.5066ca57ad4947b49930.js 1.18 MB 2 [emitted] [big] js/3.1fd4673ca5a024ef80ed.js 33.1 kB 3 [emitted] js/4.291b9a49882cf5d130c5.js 18.1 kB 4 [emitted] js/5.e583323bca56ebbb9a9e.js 17.6 kB 5 [emitted] js/6.9f3fd49978657722e329.js 302 kB 6 [emitted] [big] js/7.9a9d2f49476b983137cb.js 302 kB 7 [emitted] [big] js/8.22f61d87e848039e06a7.js 14.9 kB 8 [emitted] js/9.e8377f1d8ee372fb60dd.js 14.5 kB 9 [emitted] js/10.26692bc860ebe5c13b25.js 11.6 kB 10 [emitted] js/11.58c9f9e764ac29c56c38.js 11.1 kB 11 [emitted] js/12.197f0b56f6ab2f5394bf.js 280 kB 12 [emitted] [big] js/1.8a459384b71c7d6948fc.js 1.18 MB 1 [emitted] [big] js/14.0d1146ea3fc1b1d0039c.js 11.5 kB 14 [emitted] js/15.17bd360ab69484ab52bc.js 12.1 kB 15 [emitted] js/16.1889d1fc1bcbb8fb2a53.js 5.59 kB 16 [emitted] js/17.a86ff9655f45ba3bcbbe.js 4.99 kB 17 [emitted] js/18.09fe63c219a83c0aa655.js 5.53 kB 18 [emitted] js/19.6ce11b5b659e55ba8257.js 5.79 kB 19 [emitted] js/20.e62463d85e46fcbdd875.js 4.94 kB 20 [emitted] js/21.5b09728a830c755719fb.js 5.01 kB 21 [emitted] js/22.f96a58e52d35fe5ff745.js 5.72 kB 22 [emitted] js/23.ca4777793d63d3dda894.js 4.08 kB 23 [emitted] /js/app.js 1.54 MB 24 [emitted] [big] /js/app /js/home.js 1.98 MB 25 [emitted] [big] /js/home npm ERR! code ELIFECYCLE npm ERR! errno 2 npm ERR! @ development: cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js npm ERR! Exit status 2 npm ERR! npm ERR! Failed at the @ development script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! /Users/Aren/.npm/_logs/2017-12-23T00_59_34_280Z-debug.log npm ERR! code ELIFECYCLE npm ERR! errno 2 npm ERR! @ dev: npm run development npm ERR! Exit status 2 npm ERR! npm ERR! Failed at the @ dev script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.



自己也Google过但没找到想要的内容,看了这里的close的issue有类似的问题、说是更新npm和node,但也无用。
varichs commented 6 years ago

我也是遇到上述问题,折腾了几天,没办法

zmccz4488 commented 6 years ago

@lenkaren 是sweetalert这个包的版本太新了。找不到里面的文件。项目里的package.json里指定是2.1的。我在sweetalert这个包的github仓库地址看了。只有1.X的版本才有dev这个文件夹。所以把项目下node_modules下的sweetalert删除掉。重新安装npm install --save sweetalert@1.1.3 指定下版本。再npm run dev就可以了。

jcc commented 6 years ago

@lenkaren @varichs @zmccz4488 已修复。

yibai567 commented 6 years ago

npm run production ....

big] /js/app /css/home.css 289 kB 29 [emitted] [big] /js/app

ERROR in ./node_modules/babel-loader/lib?{"cacheDirectory":true,"presets":[["env",{"modules":false,"targets":{"browsers":["> 2%"],"uglify":true}}],"es2015","stage-2"],"plugins":["transform-object-rest-spread",["transform-runtime",{"polyfill":false,"helpers":false}]]}!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./resources/assets/js/dashboard/modules/article/Form.vue Module not found: Error: Can't resolve 'config/helper' in '/alidata/www/laravel-blog/resources/assets/js/dashboard/modules/article' @ ./node_modules/babel-loader/lib?{"cacheDirectory":true,"presets":[["env",{"modules":false,"targets":{"browsers":["> 2%"],"uglify":true}}],"es2015","stage-2"],"plugins":["transform-object-rest-spread",["transform-runtime",{"polyfill":false,"helpers":false}]]}!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./resources/assets/js/dashboard/modules/article/Form.vue 19:14-38 @ ./resources/assets/js/dashboard/modules/article/Form.vue @ ./node_modules/babel-loader/lib?{"cacheDirectory":true,"presets":[["env",{"modules":false,"targets":{"browsers":["> 2%"],"uglify":true}}],"es2015","stage-2"],"plugins":["transform-object-rest-spread",["transform-runtime",{"polyfill":false,"helpers":false}]]}!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./resources/assets/js/dashboard/modules/article/Create.vue @ ./resources/assets/js/dashboard/modules/article/Create.vue @ ./resources/assets/js/dashboard/modules/article/routes.js @ ./resources/assets/js/dashboard/modules/article/index.js @ ./resources/assets/js/dashboard/routes.js @ ./resources/assets/js/dashboard/index.js @ ./resources/assets/js/router/index.js @ ./resources/assets/js/app.js @ multi ./resources/assets/js/app.js ./resources/assets/sass/themes/default-theme.scss ./resources/assets/sass/themes/gray-theme.scss ./resources/assets/sass/app.scss ./resources/assets/sass/home.scss ..... npm ERR! code ELIFECYCLE npm ERR! errno 2 npm ERR! @ production: cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js npm ERR! Exit status 2 npm ERR! npm ERR! Failed at the @ production script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: .....

jcc commented 6 years ago

@WenHou 尝试一下 npm run hot ,dev 我晚点看看