可能存在什么问题?
> @ build /home/mafia/repo
> npm run build:src && npm run build:test
> @ build:src /home/mafia/repo
> babel src/main/webapp/js/ -x ".es6" -d src/main/webapp/js/
Error: Cannot find module 'electron-to-chromium' (While processing preset: "/home/mafia/repo/node_modules/babel-preset-env/lib/index.js")
at Function.Module._resolveFilename (module.js:470:15)
at Function.Module._load (module.js:418:25)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/home/mafia/repo/node_modules/babel-preset-env/lib/normalize-options.js:11:27)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
npm ERR! Linux 4.4.0-71-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "run" "build:src"
npm ERR! node v7.8.0
npm ERR! npm v4.2.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ build:src: `babel src/main/webapp/js/ -x ".es6" -d src/main/webapp/js/`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ build:src script 'babel src/main/webapp/js/ -x ".es6" -d src/main/webapp/js/'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! babel src/main/webapp/js/ -x ".es6" -d src/main/webapp/js/
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /home/mafia/.npm/_logs/2017-04-09T18_06_55_612Z-debug.log
npm ERR! Linux 4.4.0-71-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "run" "build"
npm ERR! node v7.8.0
npm ERR! npm v4.2.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ build: `npm run build:src && npm run build:test`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ build script 'npm run build:src && npm run build:test'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! npm run build:src && npm run build:test
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /home/mafia/.npm/_logs/2017-04-09T18_06_55_684Z-debug.log
答案1
您的问题似乎与 Ubuntu 无关,而是一个一般的编程问题。
但是,如果你真的看了输出,你就会发现Cannot find module 'electron-to-chromium'
其中的一行,它清楚地表明你的项目缺少该模块电子到铬作为依赖。
您应该能够通过在项目目录中运行以下命令来安装它,这也会将模块添加到您的依赖项列表中package.json
:
npm install --save electron-to-chromium