当我运行gulp命令时,我在reactjs项目中收到此错误。该项目显示它已成功编译但nodemon应用程序崩溃,因此我无法查看我的应用程序正在运行。
P.S。我在Mac上,当我以前在ubuntu vmware上运行它时,我曾经编译它没有任何错误。
这是我运行gulp时的错误
[00:18:43] Failed to load external module @babel/register
[00:18:43] Requiring external module babel-register
[00:18:44] Using gulpfile ~/Frontend1.0/gulpfile.babel.js
[00:18:44] Starting 'build:watch'...
[00:18:44] Starting 'copy:assets'...
[00:18:44] Starting 'copy:vendors'...
Cleaned build/
Copied 12 asset entries.
[00:18:44] Finished 'copy:vendors' after 376 ms
[00:18:44] Starting 'copy:views'...
[00:18:44] copied views all files 19.75 kB
[00:18:44] Finished 'copy:views' after 102 ms
[00:18:44] Starting 'copy:public'...
[00:18:45] Finished 'copy:public' after 222 ms
[00:18:45] Finished 'copy:assets' after 702 ms
[00:18:45] Starting 'bundle:dll'...
DLL Bundled.
Hash: 45f26d608c690be6e6c5
Version: webpack 1.15.0
Time: 4097ms
Asset Size Chunks Chunk Names
dll.vendor.js 3.11 MB 0 [emitted] vendor
[00:18:49] Finished 'bundle:dll' after 4.13 s
[00:18:49] Starting 'bundle'...
Hash: 7457a3cd38cf5c991640
Version: webpack 1.15.0
Time: 638ms
Asset Size Chunks Chunk Names
server-bundle.js 37.3 kB 0 [emitted] main
-- server:watch bundled.
Hash: 4535205365b3c29afb82
Version: webpack 1.15.0
Time: 38097ms
Asset Size Chunks Chunk Names
main-bundle.js 20.1 MB 0 [emitted] main
-- client bundled.
[00:19:27] Finished 'bundle' after 38 s
[00:19:27] Starting 'start:server'...
Starting Node Server...
[00:19:27] Finished 'start:server' after 37 ms
[00:19:27] Starting 'watch:sync'...
[00:19:27] [nodemon] 1.11.0
[00:19:27] [nodemon] to restart at any time, enter `rs`
[00:19:27] [nodemon] watching: build/server-bundle.js
[00:19:27] [nodemon] starting `node --debug build/server-bundle.js`
Server Restarted: Reloading BrowserSync.
(node:7437) [DEP0062] DeprecationWarning: `node --debug` and `node --debug-brk` are invalid. Please use `node --inspect` or `node --inspect-brk` instead.
[00:19:27] [nodemon] app crashed - waiting for file changes before starting...
[tessact: ] Proxying: http://localhost:4200
[tessact: ] Access URLs:
-------------------------------------
Local: http://localhost:3000
External: http://192.168.0.32:3000
-------------------------------------
UI: http://localhost:3001
UI External: http://192.168.0.32:3001
-------------------------------------
[tessact: ] Watching files...
[00:19:27] Finished 'watch:sync' after 211 ms
[00:19:27] Starting 'watch:assets'...
[00:19:27] Finished 'watch:assets' after 107 ms
[00:19:27] Finished 'build:watch' after 43 s
[00:19:27] Starting 'default'...
[00:19:27] Finished 'default' after 41 μs
webpack built 4535205365b3c29afb82 in 25604ms
Hash: 4535205365b3c29afb82
Version: webpack 1.15.0
Time: 25604ms
Asset Size Chunks Chunk Names
main-bundle.js 20.1 MB 0 main
webpack: Compiled successfully.
是不是因为代码片段的第一行?还是因为别的什么?我该如何解决?我尝试关闭项目并重新打开它,我也尝试了npm install。
更新:我已经通过将gulp版本从3.9.1降级到3.9.0解决了“无法加载外部模块@ babel / register”的问题。但是nodemon应用程序崩溃仍然存在。
是因为节点版本吗?我有9.4.0节点版本
答案 0 :(得分:0)
经过如此多的打击和试验后,我通过降级我正在使用的节点版本来解决它。我从9.4.0降级到6.9.1,应用程序开始工作。希望这会挽救某人的努力。