Apologies for filling so many tickets at the moment - dont think this one is down to a typo though :smiley:
fractal build runs happily directly at the command prompt / shell - however if I wrap it up into my package.json file - i.e
"scripts": {
"build": "fractal build"
}
and then try and run with npm build the following log error is generated
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'start' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle [email protected]~prestart: [email protected]
6 silly lifecycle [email protected]~prestart: no script for prestart, continuing
7 info lifecycle [email protected]~start: [email protected]
8 verbose lifecycle [email protected]~start: unsafe-perm in lifecycle true
9 verbose lifecycle [email protected]~start: PATH: C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin;C:\Users\phk\documents\workspaces\arcstyling\scaffolding\fractal\node_modules\.bin;C:\Program Files\nodejs;C:\Users\phk\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\local\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\cmd;C:\Users\phk\Downloads\ConEmu\Scripts;C:\Users\phk\Downloads;C:\Users\phk\Downloads\ConEmu;C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\Program Files (x86)\QuickTime\QTSystem;C:\WINDOWS\CCM;C:\WINDOWS\CCM;C:\WINDOWS\CCM;C:\WINDOWS\CCM;C:\WINDOWS\CCM;C:\WINDOWS\CCM;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit;C:\Program Files\Git\cmd;C:\Program Files\nodejs;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\110\Tools\Binn;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn;C:\Program Files\Microsoft SQL Server\120\Tools\Binn;C:\Program Files\Microsoft SQL Server\120\DTS\Binn;C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn;C:\Program Files\Microsoft SQL Server\110\Tools\Binn;C:\Program Files\Microsoft SQL Server\110\DTS\Binn;C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\ManagementStudio;C:\Program Files (x86)\Microsoft SQL Server\110\DTS\Binn;C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0;C:\WINDOWS\system32\config\systemprofile\.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm;C:\Program Files\Microsoft SQL Server\130\Tools\Binn;C:\Program Files (x86)\Microsoft VS Code\bin;C:\Users\phk\AppData\Roaming\npm;C:\Users\phk\AppData\Local\atom\bin;C:\Program Files\Git\usr\bin\vendor_perl;C:\Program Files\Git\usr\bin\core_perl
10 verbose lifecycle [email protected]~start: CWD: C:\Users\phk\documents\workspaces\arcstyling\scaffolding\fractal
11 silly lifecycle [email protected]~start: Args: [ '/d /s /c', 'fractal build' ]
12 silly lifecycle [email protected]~start: Returned: code: 1 signal: null
13 info lifecycle [email protected]~start: Failed to exec start script
14 verbose stack Error: [email protected] start: `fractal build`
14 verbose stack Exit status 1
14 verbose stack at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:242:16)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at EventEmitter.emit (events.js:191:7)
14 verbose stack at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:40:14)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at ChildProcess.emit (events.js:191:7)
14 verbose stack at maybeClose (internal/child_process.js:852:16)
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:215:5)
15 verbose pkgid [email protected]
16 verbose cwd C:\Users\phk\documents\workspaces\arcstyling\scaffolding\fractal
17 error Windows_NT 6.1.7601
18 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
19 error node v6.3.1
20 error npm v3.10.3
21 error code ELIFECYCLE
22 error [email protected] start: `fractal build`
22 error Exit status 1
23 error Failed at the [email protected] start script 'fractal build'.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the fractal-test package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error fractal build
23 error You can get information on how to open an issue for this project with:
23 error npm bugs fractal-test
23 error Or if that isn't available, you can get their info via:
23 error npm owner ls fractal-test
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]
node etc are all up to date. Something wrong at a local config error perhaps ?
I think you need to run npm run build as opposed to npm build - only npm start (as far as I know) can be used without the run bit in there.
Let me know if that sorts it - and no worries, keep the issues coming, all makes good points to cover in the docs if anything isn't immediately obvious.
had already tried that ( sorry should have said ) and had similarly included
"scripts": {
"start": "fractal start --sync",
"build": "fractal build"
}
and calling it with npm start through similar exceptions.
Might just be a windows thing - gonna clone my repos to my MBP and see if I get similar errors there.
Hi @pete-hotchkiss, really sorry for the slow replies, still on holiday and struggling to carve out time to work on all the Fractal-related stuff I need to do!
I've had another report that the build is failing on Windows machines but I don't have any way to test it right now - I'm back in the office in a week or so and will look into then as a matter of priority!
Did you get it working ok on your MBP in the end?
no need to apologise buddy :-)
Ran without any problems on the MBP - typical.
To be honest, I'd 'parked' it for the moment as project is still very much in dev phase so dont need to worry to much about production/release builds.
Have a work around which wraps a few things in a gulp task - that serves for now though. I should have some more time early next week to look narrowing down exactly why it's happening.
Ok great, any more insight into the issue would definitely be appreciated - windows is not my strong point :-)
But i've got a test laptop at work so should be able to debug it on that. Definitely need to get the builds working on windows too.
The npm scripts documentation says that arbitrary scripts can be run using $ npm run-script <scriptname> as opposed to just using run as suggested here. I doubt this would be different for Windows and other OSes, but I just ran into this issue earlier.
I can confirm that windows has a problem with Fractal inside of an NPM script.
I created a brand new project
created this script
"scripts": {
"start": "fractal start --sync"
}
run npm run start and everything starts, then a little box pops up and then goes away and i go back to the prompt.
http://i.imgur.com/e76ko3P.gifv
If I do ./node_modules/.bin/fractal start --sync it works just fine. But the same command aliased via npm doesn't work.
@micahgodbolt what happens if instead of npm run start you just use npm start. Start is one of the default scripts that can be started without specifying run first.
@matijs sorry, crazy late reply. Same thing. Just started a brand new project on windows and I am having zero luck.
@micahgodbolt do you think you can share your package.json file here so I can try and replicate?
Also - if you install other node modules globally, does running those work? If not it may be that Node modules are not in your current shell path (http://stackoverflow.com/questions/9587665/nodejs-cannot-find-installed-module-on-windows).
Clutching at straws a bit here but just trying to eliminate some potential causes.
BOOM! The issue with windows and a config file called fractal.js. If you update your package.json to include
"fractal": {
"main": "fractalfile.js"
},
then change the name of your fractal.js to fractalfile.js it seems everything works!.
@micahgodbolt THANK YOU for you persistence in tracking down this issue - it was completely stumping me (with my lack of Windows knowledge) to be honest.
I'll add a note to the docs that about this for Windows users and I guess should consider renaming the default fractal.js config file to something else to avoid this issue altogether in the future.
I'd still like to figure out why it affects some people and not others but as long as there is a solution I can dig into that some other time.
Many thanks again :-)
The tip by @micahgodbolt works for me too. Apparently, the fractal property in your project's package.json is read by fractal. pkg.fractal.main refers to the fractal config. Seems like a undocumented feature.
{
"fractal": {
"main": "fractal.config.js"
}
}
FYI - I had the same issue on OSX (el capitan). The same workaround that @micahgodbolt posted worked for me, but starting to wonder if it is not contained to just Windows?
This was resolved in #581.
Most helpful comment
BOOM! The issue with windows and a config file called
fractal.js. If you update your package.json to includethen change the name of your fractal.js to fractalfile.js it seems everything works!.