medialize/ally.js

"npm run init" is failing on build:pre

t-kelly opened this issue · 5 comments

Fails after running npm run init on a fresh clone.
npm-debug.log

0 info it worked if it ends with ok
1 verbose cli [ '/Users/thomaskelly/.nvm/versions/node/v5.7.0/bin/node',
1 verbose cli   '/Users/thomaskelly/.nvm/versions/node/v5.7.0/bin/npm',
1 verbose cli   'run',
1 verbose cli   'init' ]
2 info using npm@3.6.0
3 info using node@v5.7.0
4 verbose run-script [ 'preinit', 'init', 'postinit' ]
5 info lifecycle ally.js@1.1.0~preinit: ally.js@1.1.0
6 silly lifecycle ally.js@1.1.0~preinit: no script for preinit, continuing
7 info lifecycle ally.js@1.1.0~init: ally.js@1.1.0
8 verbose lifecycle ally.js@1.1.0~init: unsafe-perm in lifecycle true
9 verbose lifecycle ally.js@1.1.0~init: PATH: /Users/thomaskelly/.nvm/versions/node/v5.7.0/lib/node_modules/npm/bin/node-gyp-bin:/Users/thomaskelly/src/shopify/ally.js/node_modules/.bin:/Users/thomaskelly/.gem/ruby/2.2.3/bin:/usr/local/Cellar/shopify-ruby/2.2.3-shopify_2/lib/ruby/gems/2.2.0/bin:/opt/rubies/2.2.3p172-shopify/bin:/Users/thomaskelly/codes/golang/src/github.com/shopify/themekit/build/development:/Users/thomaskelly/codes/golang:/Users/thomaskelly/codes/golang/bin:/Users/thomaskelly/.rbenv/shims:/Users/thomaskelly/.themekit:/Users/thomaskelly/.nvm/versions/node/v5.7.0/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/thomaskelly/.rbenv/bin:/usr/local/opt/go/libexec/bin:/Users/thomaskelly/codes/golang/bin
10 verbose lifecycle ally.js@1.1.0~init: CWD: /Users/thomaskelly/src/shopify/ally.js
11 silly lifecycle ally.js@1.1.0~init: Args: [ '-c',
11 silly lifecycle   'npm install && npm run build && npm run build:website' ]
12 silly lifecycle ally.js@1.1.0~init: Returned: code: 1  signal: null
13 info lifecycle ally.js@1.1.0~init: Failed to exec init script
14 verbose stack Error: ally.js@1.1.0 init: `npm install && npm run build && npm run build:website`
14 verbose stack Exit status 1
14 verbose stack     at EventEmitter.<anonymous> (/Users/thomaskelly/.nvm/versions/node/v5.7.0/lib/node_modules/npm/lib/utils/lifecycle.js:232:16)
14 verbose stack     at emitTwo (events.js:100:13)
14 verbose stack     at EventEmitter.emit (events.js:185:7)
14 verbose stack     at ChildProcess.<anonymous> (/Users/thomaskelly/.nvm/versions/node/v5.7.0/lib/node_modules/npm/lib/utils/spawn.js:24:14)
14 verbose stack     at emitTwo (events.js:100:13)
14 verbose stack     at ChildProcess.emit (events.js:185:7)
14 verbose stack     at maybeClose (internal/child_process.js:827:16)
14 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
15 verbose pkgid ally.js@1.1.0
16 verbose cwd /Users/thomaskelly/src/shopify/ally.js
17 error Darwin 15.4.0
18 error argv "/Users/thomaskelly/.nvm/versions/node/v5.7.0/bin/node" "/Users/thomaskelly/.nvm/versions/node/v5.7.0/bin/npm" "run" "init"
19 error node v5.7.0
20 error npm  v3.6.0
21 error code ELIFECYCLE
22 error ally.js@1.1.0 init: `npm install && npm run build && npm run build:website`
22 error Exit status 1
23 error Failed at the ally.js@1.1.0 init script 'npm install && npm run build && npm run build:website'.
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 ally.js package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error     npm install && npm run build && npm run build:website
23 error You can get information on how to open an issue for this project with:
23 error     npm bugs ally.js
23 error Or if that isn't available, you can get their info via:
23 error     npm owner ls ally.js
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]

I can reproduce the issue with node v4.2.2 and npm v2.14.7:

> ally.js@1.1.0 build:pre /…/ally.js
> node build/build.pre.js

fs.js:549
  return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
                                                  ^
Error: ENOENT: no such file or directory, open '/…/ally.js/dist/src/version.js'
    at Error (native)
    at Object.fs.openSync (fs.js:549:18)
    at Object.fs.writeFileSync (fs.js:1156:15)
    at writeVersionFile (/…/ally.js/build/build.pre.js:25:6)
    at Object.<anonymous> (/…/ally.js/build/build.pre.js:29:1)
    at Module._compile (module.js:435:26)
    at Object.Module._extensions..js (module.js:442:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:311:12)
    at Function.Module.runMain (module.js:467:10)

hm, running npm run clean before npm run build does the job…

Thanks for pointing this out! you should now get a proper instance after running npm run init. If you continue to experience problems, that's possibly related to either npm v3.6.0 or node v5.7.0. a new issue would be appreciated :)

npm run clean worked! Still worth investigating why this fails on a fresh clone tho?

npm run clean removes and creates a few directories touched by the build tools. npm run build assumes these directories exist and does not create them. The fix here is to simply run clean before build.