Unable to run "npm run build:lib" command
Describe the bug
A clear and concise description of what the bug is.
To reproduce
Steps to reproduce the behavior:
- Build web-component using npx direflow-cli create command
- 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
Thanks for creating this bug. We'll investigate :+1:
Hi @assignments-tataaig I haven't been able to reproduce this bug. Can you provide some more context?
- Are you using TypeScript or JavaScript
- Does the file
component-exports.jscorrectly exist insrcfolder? - Does it correctly export the components you want to include?
- What happens if you install
direflowglobally instead of usingnpx?
Thank you.
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)
[email protected] 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! [email protected] build:lib: direflow-scripts build:lib
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] 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 [email protected]
3 info using [email protected]
4 verbose run-script [ 'prebuild:lib', 'build:lib', 'postbuild:lib' ]
5 info lifecycle [email protected]~prebuild:lib: [email protected]
6 info lifecycle [email protected]~build:lib: [email protected]
7 verbose lifecycle [email protected]~build:lib: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~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 [email protected]~build:lib: CWD: C:\Users\RomaneDonnet\Desktop\direflow35\df35-component
10 silly lifecycle [email protected]~build:lib: Args: [ '/d /s /c', 'direflow-scripts build:lib' ]
11 silly lifecycle [email protected]~build:lib: Returned: code: 1 signal: null
12 info lifecycle [email protected]~build:lib: Failed to exec build:lib script
13 verbose stack Error: [email protected] build:lib: direflow-scripts build:lib
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.direflow-scripts build:lib
22 error Exit status 1
23 error Failed at the [email protected] 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 ]
Thanks a lot, @romane-echino :+1: This helps a lot. It seems to be an issue with Webpack on Windows. We'll look into this as soon as possible!
Any updates? Sorry for disturbing
Same issue here. Any updates/workarounds?
Any updates on this? 2 of my team members are also facing same issue.
Same issue with either Javascript or Typescript
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!
It is true that has to be something with Windows only, I Installed Windows Subsystem for Linux, and run the script from the Ubuntu console and it worked.
This may help to resolve this issue. https://github.com/facebook/create-react-app/issues/9455