hjyssg / ShiguReader

硬核宅宅资源管理器. Ultimate Manga Resource Manager
MIT License
400 stars 45 forks source link

'npm run dev' command failed #85

Closed klein2000 closed 4 years ago

klein2000 commented 4 years ago

Hi hjyssg, Thanks for your hard work. I followed your instructions and installed node.js and git bash on my Win10 laptop. I was coding in visual studio code. All went well until the final command. It seems something got wrong when executing 'npm run dev'. You can check more details in below. It'll be greatly appreciated if you can give me some help.

$npm run dev

ShiguReader@1.3.3 dev D:\ShiguReader\ShiguReader concurrently "npm run server" "npm run client"

[1] [1] ┌────────────────────────────────────────────────────────────┐ [1] │ npm update check failed │ [1] │ Try running with sudo or get access │ [1] │ to the local update config store via │ [1] │ sudo chown -R $USER:$(id -gn $USER) C:\Users\syuny.config │ [1] └────────────────────────────────────────────────────────────┘ [0] [0] > ShiguReader@1.3.3 server D:\ShiguReader\ShiguReader [0] > nodemon src/server/index.js [0] [1] [1] > ShiguReader@1.3.3 client D:\ShiguReader\ShiguReader [1] > webpack-dev-server --mode development --devtool inline-source-map --hot [1] [0] [nodemon] 1.18.9 [0] [nodemon] to restart at any time, enter rs [0] [nodemon] watching: D:\ShiguReader\ShiguReader\src\server//* D:\ShiguReader\ShiguReader\src\common/*/ D:\ShiguReader\ShiguReader\src\config//* src/path-config [0] [nodemon] starting node src/server/index.js [0] D:\ShiguReader\ShiguReader\node_modules\internal-ip\index.js:26 [0] } catch {} [0] ^ [0] [0] SyntaxError: Unexpected token { [0] at createScript (vm.js:80:10) [0] at Object.runInThisContext (vm.js:139:10) [0] at Module._compile (module.js:617:28) [0] at Object.Module._extensions..js (module.js:664:10) [0] at Module.load (module.js:566:32) [0] at tryModuleLoad (module.js:506:12) [0] at Function.Module._load (module.js:498:3) [0] at Module.require (module.js:597:17) [0] at require (internal/module.js:11:18) [0] at Object. (D:\ShiguReader\ShiguReader\src\server\index.js:8:20) [0] [nodemon] app crashed - waiting for file changes before starting... [1] clean-webpack-plugin: D:\ShiguReader\ShiguReader\dist has been removed. [1] i 「wds」: Project is running at http://0.0.0.0:3000/ [1] i 「wds」: webpack output is served from / [1] i 「wds」: Content not from webpack is served from D:\ShiguReader\ShiguReader [1] i 「wds」: 404s will fallback to /index.html [1] Browserslist: caniuse-lite is outdated. Please run next command npm update caniuse-lite browserslist [1] i 「wdm」: Hash: 1939f3c57830ddb4f096 [1] Version: webpack 4.43.0 [1] Time: 7286ms [1] Built at: 2020-07-31 00:17:53 [1] Asset Size Chunks Chunk Names [1] bundle.js 10.8 MiB main [emitted] main [1] favicon-96x96.png 15.4 KiB [emitted] [1] index.html 576 bytes [emitted] [1] Entrypoint main = bundle.js [1] [0] multi (webpack)-dev-server/client?http://0.0.0.0:3000 (webpack)/hot/dev-server.js babel-polyfill ./src/client/index.js 64 bytes {main} [built] [1] [./node_modules/babel-polyfill/lib/index.js] 833 bytes {main} [built] [1] [./node_modules/core-js/fn/regexp/escape.js] 108 bytes {main} [built] [1] [./node_modules/core-js/shim.js] 8.03 KiB {main} [built] [1] [./node_modules/react-dom/index.js] 1.33 KiB {main} [built] [1] [./node_modules/react-router-dom/es/index.js] 1010 bytes {main} [built] [1] [./node_modules/react/index.js] 190 bytes {main} [built] [1] [./node_modules/regenerator-runtime/runtime.js] 23.9 KiB {main} [built] [1] [./node_modules/webpack-dev-server/client/index.js?http://0.0.0.0:3000] (webpack)-dev-server/client?http://0.0.0.0:3000 4.29 KiB {main} [built] [1] [./node_modules/webpack-dev-server/client/overlay.js] (webpack)-dev-server/client/overlay.js 3.51 KiB {main} [built] [1] [./node_modules/webpack-dev-server/client/socket.js] (webpack)-dev-server/client/socket.js 1.53 KiB {main} [built] [1] [./node_modules/webpack-dev-server/client/utils/createSocketUrl.js] (webpack)-dev-server/client/utils/createSocketUrl.js 2.91 KiB {main} [built] [1] [./node_modules/webpack-dev-server/client/utils/log.js] (webpack)-dev-server/client/utils/log.js 964 bytes {main} [built] [1] [./node_modules/webpack/hot/dev-server.js] (webpack)/hot/dev-server.js 1.59 KiB {main} [built] [1] [./src/client/index.js] 295 bytes {main} [built] [1] + 858 hidden modules [1] Child html-webpack-plugin for "index.html": [1] 1 asset [1] Entrypoint undefined = index.html [1] [./node_modules/html-webpack-plugin/lib/loader.js!./public/index.html] 693 bytes {0} [built] [1] [./node_modules/lodash/lodash.js] 528 KiB {0} [built] [1] [./node_modules/webpack/buildin/global.js] (webpack)/buildin/global.js 472 bytes {0} [built] [1] [./node_modules/webpack/buildin/module.js] (webpack)/buildin/module.js 497 bytes {0} [built] [1] i 「wdm」: Compiled successfully.

hjyssg commented 4 years ago

internal-ip is small util to get the LAN IP. I only use it to show the LAN IP of the server PC for user convenience.

Since you are using VS, I assume you are a coder. You can just comment out the code in server/index.js.

I will also investigate this bug tomorrow.

hjyssg commented 4 years ago

Fixed in https://github.com/hjyssg/ShiguReader/commit/305922a0e767b85bc8a98ac8e973c40a4fedf3c8.

I guess that internal-ip is not stable on some computers. I added a try catch