question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to run "npm run build:lib" command

See original GitHub issue

Describe the bug
A clear and concise description of what the bug is.

To reproduce
Steps to reproduce the behavior:

  1. Build web-component using npx direflow-cli create command
  2. Once command is created run “npm run build:lib” command it will throw below error

"Building React component library… events.js:292 throw er; // Unhandled ‘error’ event ^ "

Expected behavior
Should have created folder lib with React components.

Package Manager:
To install Direflow, I used npm

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
SimonHoibergcommented, Aug 29, 2020

Thanks a lot, @romane-echino 👍 This helps a lot. It seems to be an issue with Webpack on Windows. We’ll look into this as soon as possible!

3reactions
romane-echinocommented, Aug 27, 2020

Hi! I’m having the same problem. I just ran “direflow create” on an empty project folder and I’m having the same issue. here is my configuration:

Are you using TypeScript or JavaScript : Typescript Does the file component-exports.js correctly exist in src folder? There is a typescript one inside source folder (src/component-exports.ts) Does it correctly export the components you want to include? It’s bascally exporting the default App component What happens if you install direflow globally instead of using npx? I installed it via global direflow-cli command

I’m running Windows 10 (v2004) Professional x64. with visual studio code IDE.

Console output:

$direflow create ? Choose a name for your Direflow Setup: df35 ? Give your Direflow Setup a description (optional) ? Which language do you want to use? TypeScript ? Which linter do you want to use? ESLint ? Do you want this to be an NPM module? Yes

$cd .\df35-component\ $npm install $npm start (Working) $npm run build (Working) $npm run build:lib (NOT WORKING)

df35-component@1.0.0 build:lib C:\Users\RomaneDonnet\Desktop\direflow35\df35-component direflow-scripts build:lib

Building React component library… events.js:174 throw er; // Unhandled ‘error’ event ^

Error: spawn webpack ENOENT at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19) at onErrorNT (internal/child_process.js:415:16) at process._tickCallback (internal/process/next_tick.js:63:19) at Function.Module.runMain (internal/modules/cjs/loader.js:757:11) at startup (internal/bootstrap/node.js:283:19) at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3) Emitted ‘error’ event at: at Process.ChildProcess._handle.onexit (internal/child_process.js:246:12) at onErrorNT (internal/child_process.js:415:16) [… lines matching original stack trace …] at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! df35-component@1.0.0 build:lib: direflow-scripts build:lib npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the df35-component@1.0.0 build:lib 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! C:\Users\RomaneDonnet\AppData\Roaming\npm-cache_logs\2020-08-27T13_04_50_702Z-debug.log

Complete log

0 info it worked if it ends with ok 1 verbose cli [ ‘C:\Program Files\nodejs\node.exe’, 1 verbose cli ‘C:\Users\RomaneDonnet\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js’, 1 verbose cli ‘run’, 1 verbose cli ‘build:lib’ ] 2 info using npm@6.14.2 3 info using node@v10.15.3 4 verbose run-script [ ‘prebuild:lib’, ‘build:lib’, ‘postbuild:lib’ ] 5 info lifecycle df35-component@1.0.0~prebuild:lib: df35-component@1.0.0 6 info lifecycle df35-component@1.0.0~build:lib: df35-component@1.0.0 7 verbose lifecycle df35-component@1.0.0~build:lib: unsafe-perm in lifecycle true 8 verbose lifecycle df35-component@1.0.0~build:lib: PATH: C:\Users\RomaneDonnet\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\RomaneDonnet\Desktop\direflow35\df35-component\node_modules.bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Program Files\dotnet;C:\Program Files\Microsoft SQL Server\130\Tools\Binn;C:\Program Files (x86)\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn;C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn;C:\Program Files (x86)\Microsoft SQL Server\140\DTS\Binn;C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\ManagementStudio;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\Microsoft Emulator Manager\1.0;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit;C:\Program Files (x86)\Windows Kits\10\Microsoft Application Virtualization\Sequencer;C:\Program Files\nodejs;C:\Program Files\Microsoft VS Code\bin;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;C:\Program Files (x86)\Yarn\bin;C:\Program Files\Microsoft\Web Platform Installer;C:\Program Files\PuTTY;C:\Program Files\Git\cmd;C:\Ruby26-x64\bin;C:\Ruby23-x64\bin;C:\RailsInstaller\Ruby2.2.0\bin;C:\Users\RomaneDonnet\AppData\Local\Programs\Python\Python37-32\Scripts;C:\Users\RomaneDonnet\AppData\Local\Programs\Python\Python37-32;C:\Users\RomaneDonnet\AppData\Local\Microsoft\WindowsApps;;C:\Users\RomaneDonnet\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\RomaneDonnet\AppData\Roaming\npm;C:\Program Files\JetBrains\WebStorm 2019.1\bin;;C:\Users\RomaneDonnet\AppData\Local\Yarn\bin;C:\Users\RomaneDonnet.dotnet\tools 9 verbose lifecycle df35-component@1.0.0~build:lib: CWD: C:\Users\RomaneDonnet\Desktop\direflow35\df35-component 10 silly lifecycle df35-component@1.0.0~build:lib: Args: [ ‘/d /s /c’, ‘direflow-scripts build:lib’ ] 11 silly lifecycle df35-component@1.0.0~build:lib: Returned: code: 1 signal: null 12 info lifecycle df35-component@1.0.0~build:lib: Failed to exec build:lib script 13 verbose stack Error: df35-component@1.0.0 build:lib: direflow-scripts build:lib 13 verbose stack Exit status 1 13 verbose stack at EventEmitter.<anonymous> (C:\Users\RomaneDonnet\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16) 13 verbose stack at EventEmitter.emit (events.js:189:13) 13 verbose stack at ChildProcess.<anonymous> (C:\Users\RomaneDonnet\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14) 13 verbose stack at ChildProcess.emit (events.js:189:13) 13 verbose stack at maybeClose (internal/child_process.js:970:16) 13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5) 14 verbose pkgid df35-component@1.0.0 15 verbose cwd C:\Users\RomaneDonnet\Desktop\direflow35\df35-component 16 verbose Windows_NT 10.0.19041 17 verbose argv “C:\Program Files\nodejs\node.exe” “C:\Users\RomaneDonnet\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js” “run” “build:lib” 18 verbose node v10.15.3 19 verbose npm v6.14.2 20 error code ELIFECYCLE 21 error errno 1 22 error df35-component@1.0.0 build:lib: direflow-scripts build:lib 22 error Exit status 1 23 error Failed at the df35-component@1.0.0 build:lib script. 23 error This is probably not a problem with npm. There is likely additional logging output above. 24 verbose exit [ 1, true ]

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using "npm run build" fails with "npm ERR! missing script: build"
First check you have .babelrc file in your root folder. if you already have. Add this in your package.json file
Read more >
The command `npm run build` is not working since updating to ...
Hi there, i've updated the sources to OJS 3.2 and the command npm run build mentioned in README.md returns with errors. I followed...
Read more >
npm-build
This is the plumbing command called by npm link and npm install . It should generally be called during installation, but if you...
Read more >
ChromeHeadless error stoping npm run test (Angular 7+)
Hi there, Since yesterday I have been getting an error while testing an angular app. It stops when it tries to kill the...
Read more >
Can't find main.js /appium folder - Support
Hello. So I recently switched from the appium GUI to the appium npm version. I installed it with the npm install -g appium...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found