Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to build from this repository #237

Closed
rohitagre opened this issue Jun 7, 2017 · 6 comments
Closed

Unable to build from this repository #237

rohitagre opened this issue Jun 7, 2017 · 6 comments

Comments

@rohitagre
Copy link

I have cloned this repository on my local machine and even after successfully running npm install i am unable to run gulp as mentioned in the readme.

I am a noob in this area, this is the error that i get
[11:51:57] No gulpfile found

Please help me.

P.s. if this helps,
OS Windows 10
node 6.10.3
npm 5.0.3
gulp CLI 3.9.1
node-gyp 3.6.2

@jasonpang
Copy link
Contributor

@Jammer99 Sorry for the lack of clearer instructions, can you try:

# Do this in the root project directory
chmod +x sdk
# Install yarn first if you don't have it 
yarn
./sdk build --tests
./sdk test

@rohitagre
Copy link
Author

Unfortunately, i am on windows :(
I was able to run yarn, but not the bash scripts. any other alternative?

@jasonpang
Copy link
Contributor

@Jammer99, sorry about the lack of cross-platform build support. You definitely don't need to build the SDK from our source code in order to use push notifications. Have you seen our web push setup guide? We recommend linking to https://cdn.onesignal.com/sdks/OneSignalSDK.js in order to always get the most up-to-date SDK.

What specific build error did you encounter on Windows?

@rohitagre
Copy link
Author

I tried it on ubuntu system, I am getting the same error on running gulp.
[12:51:22] No gulpfile found

Also I tried with yarn
this is the error i am getting.

root@Jammer:/mnt/d/Github/OneSignal-Website-SDK# chmod +x sdk

root@Jammer:/mnt/d/Github/OneSignal-Website-SDK# yarn
ERROR: There are no scenarios; must have at least one.

root@Jammer:/mnt/d/Github/OneSignal-Website-SDK# ./sdk build --tests
/mnt/d/Github/OneSignal-Website-SDK/sdk:136
  static async printFinalBuildTimeString(context, sdkVersion) {
               ^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Unexpected identifier
    at createScript (vm.js:56:10)
    at Object.runInThisContext (vm.js:97:10)
    at Module._compile (module.js:542:28)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.runMain (module.js:604:10)
    at run (bootstrap_node.js:389:7)
    at startup (bootstrap_node.js:149:9)
root@Jammer:/mnt/d/Github/OneSignal-Website-SDK# ./sdk build --tests

Also, I just want to see the build process, i am not planning to use it on my project. I am using the CDN link only.

@jasonpang
Copy link
Contributor

jasonpang commented Jun 9, 2017

Hey @Jammer99,

  1. You'll have to install the latest node (I forgot which is the minimum version, but it must support async and await without needing to use the --harmony flag which enables experimental features. async and await landed without needing to use a flag in a recent version of node v7.x+ but I forget which, so install the latest using nvm or something similar). We use the latest JS features in our build script so only the latest version of Node can support this.

  2. It looks like your yarn package is a different software package of the same name. Use this guide to install Yarn on Linux.

  3. Don't run gulp, since we no longer use Gulp to build our SDK.

  4. With the above steps, hopefully you should at least get to the point where you can run ./sdk in the root web SDK directory, and get something like:

    ~/code/OneSignal-Website-SDK on  master [$!] via ⬢ v7.7.1
     ➜ ./sdk
     ★ OneSignal Web SDK Build Tool ★
    
     Commands:
       build  Builds the web SDK.
              Optionally add '--tests' to build with tests.                                                      [aliases: b]
       test   Tests the web SDK, by running unit tests in the tests/ folder.
              Optionally add '--only' to test a single file, or '--debug' to debug the test with Chrome's Developer Tools.
                                                                                                                 [aliases: t]
    
     Options:
       --help, -h                    Show help                                                                      [boolean]
       --env, -e                     The target environment for this build.
                               [string] [required] [choices: "development", "staging", "production"] [default: "development"]
       --config                      Path to config.json file.                          [required] [default: "./config.json"]
     ...
     ...
     ...
    
  5. After that, run cp config.json.example config.json, the default parameters in there should be okay


After all of this, try running:

./sdk build --noBundle --disableTransformSourceMaps --tests
  • --noBundle prevents an error with the SDK trying to copy to a directory that won't exist on your computer
  • --disableTransformSourceMaps might help if you don't have sorcery installed, which follows a chain of source maps to generate one final integrated source map
  • --tests for tests

Hopefully that works, you should see:

➜ ./sdk build --noBundle --disableTransformSourceMaps --tests
OneSignal Web SDK Build Tool
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Environment: DEVELOPMENT
Current Working Directory: /Users/jpang/code/OneSignal-Website-SDK

[Clean] Remove /Users/jpang/code/OneSignal-Website-SDK/build

[TypeScript Transpiler] Using TypeScript config file: 'tsconfig.tests.json'
[TypeScript Transpiler] 2:22:03 PM - Compilation complete. Watching for file changes.

[Initial Build Finished] Finished building SDK version 130025 in 2693ms. Watching for changes...

Then run:

./sdk test

You should see:

~/code/OneSignal-Website-SDK on  master [$!] via ⬢ v7.7.1
➜ ./sdk test

[Tests] Running 'ava --verbose --watch'

  ✔ managers › AltOriginManager › should get correct canonical subscription URL
  ✔ managers › AltOriginManager › should discover alt origin to be subdomain.onesignal.com if user is already subscribed there
  ✔ managers › AltOriginManager › should discover alt origin to be subdomain.os.tc if user is not subscribed to onesignal.com but is subscribed to os.tc
  ✔ managers › AltOriginManager › should discover alt origin to be subdomain.os.tc if user is not subscribed to either onesignal.com or os.tc
  ✔ utils › timeoutPromise should reject after the specified amount of time
  ✔ utils › timeoutPromise should resolve target promise if its faster
  ✔ serviceWorker › filterNotificationOptions › Chrome on Mac should set requireInteraction to false
  ✔ serviceWorker › filterNotificationOptions › A browser env other than Chrome on Mac should not have requireInteraction forced to false
...

@jwilm
Copy link

jwilm commented Jan 18, 2018

Closing due to inactivity

@jwilm jwilm closed this as completed Jan 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants