npm build fails #118

Open
pete-hotchkiss opened this Issue Aug 11, 2016 · 14 comments

Comments

Projects
None yet
6 participants
@pete-hotchkiss

Apologies for filling so many tickets at the moment - dont think this one is down to a typo though 馃槂

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 npm@3.10.3
3 info using node@v6.3.1
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle fractal-test@1.0.0~prestart: fractal-test@1.0.0
6 silly lifecycle fractal-test@1.0.0~prestart: no script for prestart, continuing
7 info lifecycle fractal-test@1.0.0~start: fractal-test@1.0.0
8 verbose lifecycle fractal-test@1.0.0~start: unsafe-perm in lifecycle true
9 verbose lifecycle fractal-test@1.0.0~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 fractal-test@1.0.0~start: CWD: C:\Users\phk\documents\workspaces\arcstyling\scaffolding\fractal
11 silly lifecycle fractal-test@1.0.0~start: Args: [ '/d /s /c', 'fractal build' ]
12 silly lifecycle fractal-test@1.0.0~start: Returned: code: 1  signal: null
13 info lifecycle fractal-test@1.0.0~start: Failed to exec start script
14 verbose stack Error: fractal-test@1.0.0 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 fractal-test@1.0.0
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 fractal-test@1.0.0 start: `fractal build`
22 error Exit status 1
23 error Failed at the fractal-test@1.0.0 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 ?

@allmarkedup

This comment has been minimized.

Show comment
Hide comment
@allmarkedup

allmarkedup Aug 11, 2016

Member

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.

Member

allmarkedup commented Aug 11, 2016

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.

@pete-hotchkiss pete-hotchkiss changed the title from _npm build_ fails to npm build fails Aug 11, 2016

@pete-hotchkiss

This comment has been minimized.

Show comment
Hide comment
@pete-hotchkiss

pete-hotchkiss Aug 11, 2016

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.

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.

@allmarkedup

This comment has been minimized.

Show comment
Hide comment
@allmarkedup

allmarkedup Aug 17, 2016

Member

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?

Member

allmarkedup commented Aug 17, 2016

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?

@allmarkedup allmarkedup added the bug label Aug 17, 2016

@pete-hotchkiss

This comment has been minimized.

Show comment
Hide comment
@pete-hotchkiss

pete-hotchkiss Aug 17, 2016

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.

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.

@allmarkedup

This comment has been minimized.

Show comment
Hide comment
@allmarkedup

allmarkedup Aug 17, 2016

Member

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.

Member

allmarkedup commented Aug 17, 2016

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.

@matijs

This comment has been minimized.

Show comment
Hide comment
@matijs

matijs Aug 29, 2016

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.

matijs commented Aug 29, 2016

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.

@micahgodbolt

This comment has been minimized.

Show comment
Hide comment
@micahgodbolt

micahgodbolt Sep 13, 2016

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.

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.

@matijs

This comment has been minimized.

Show comment
Hide comment
@matijs

matijs Sep 14, 2016

@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 commented Sep 14, 2016

@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.

@micahgodbolt

This comment has been minimized.

Show comment
Hide comment
@micahgodbolt

micahgodbolt Oct 19, 2016

@matijs sorry, crazy late reply. Same thing. Just started a brand new project on windows and I am having zero luck.

@matijs sorry, crazy late reply. Same thing. Just started a brand new project on windows and I am having zero luck.

@allmarkedup

This comment has been minimized.

Show comment
Hide comment
@allmarkedup

allmarkedup Oct 20, 2016

Member

@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.

Member

allmarkedup commented Oct 20, 2016

@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.

@micahgodbolt

This comment has been minimized.

Show comment
Hide comment
@micahgodbolt

micahgodbolt Oct 20, 2016

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!.

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!.

@allmarkedup

This comment has been minimized.

Show comment
Hide comment
@allmarkedup

allmarkedup Oct 21, 2016

Member

@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 :-)

Member

allmarkedup commented Oct 21, 2016

@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 :-)

@timseverien

This comment has been minimized.

Show comment
Hide comment
@timseverien

timseverien Jun 13, 2017

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"
  }
}

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"
  }
}
@elFani

This comment has been minimized.

Show comment
Hide comment
@elFani

elFani Jul 10, 2018

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?

elFani commented Jul 10, 2018

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment