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

🚨 Having trouble with 'nx build nativescript-{yourapp}'? See... #51

Closed
NathanWalker opened this issue Apr 22, 2022 · 16 comments · Fixed by #57
Closed

🚨 Having trouble with 'nx build nativescript-{yourapp}'? See... #51

NathanWalker opened this issue Apr 22, 2022 · 16 comments · Fixed by #57
Labels
question Further information is requested

Comments

@NathanWalker
Copy link
Contributor

NathanWalker commented Apr 22, 2022

A new requirement is that every flag with a value must be separated with an = to ensure any flags which should never be duplicated are properly deduped (in event it was accidentally added twice):

Case 1

  • BAD
nx build nativescript-app:android:prod --uglify --key-store-path upload-keystore.jks --key-store-password xxxxxx --key-store-alias xxx --key-store-alias-password xxxxxxx --skip-nx-cache --aab
  • GOOD
nx build nativescript-app:android:prod --uglify --key-store-path=upload-keystore.jks --key-store-password=xxxxxx --key-store-alias=xxx --key-store-alias-password=xxxxxxx --skip-nx-cache --aab

Notice the usage of = between key/values.

Case 2

If you notice your build command turning into nx run or ns debug in a CI Pipeline you may need to use an alternate format, for example:

  • Potentially problematic depending on pipeline setup:
nx build nativescript-app:ios:prod

――――――――――――――――――――――――
Running NativeScript CLI within apps/nativescript-app/
ns debug ios --no-hmr --env.uglify --env.production --for-device --release

Wait what?! Notice the nx build turned into ns debug - that's not what we want.

  • Solution:
nx run nativescript-app:build:prod --platform=ios

――――――――――――――――――――――――
Running NativeScript CLI within apps/nativescript-app/
ns build ios --no-hmr --env.uglify --env.production --for-device --release

There we go, it properly builds now.

@NathanWalker NathanWalker added the question Further information is requested label Apr 22, 2022
@NathanWalker NathanWalker pinned this issue Apr 22, 2022
@NathanWalker NathanWalker changed the title Having trouble with 'nx build nativescript-{yourapp}'? See here... Having trouble with 'nx build nativescript-{yourapp}'? See... Apr 22, 2022
@NathanWalker NathanWalker changed the title Having trouble with 'nx build nativescript-{yourapp}'? See... 🚨 Having trouble with 'nx build nativescript-{yourapp}'? See... Apr 22, 2022
@JakeAi
Copy link
Contributor

JakeAi commented Jun 7, 2022

@NathanWalker Whatever was updated since 3.0.14 kind of makes this unusable, especially without an example project.json. No matter what I do it runs a debug command, or I get an error for isUnitTesting or

The arguments 'C:\Program Files\nodejs\node.exe C:\Development\repo\node_modules\nx\bin\run-executor.js' are not valid for the current command.

@NathanWalker
Copy link
Contributor Author

@NathanWalker Whatever was updated since 3.0.14 kind of makes this unusable, especially without an example project.json. No matter what I do it runs a debug command, or I get an error for isUnitTesting or

The arguments 'C:\Program Files\nodejs\node.exe C:\Development\repo\node_modules\nx\bin\run-executor.js' are not valid for the current command.

@JakeAi I believe you got past that but ping back here if not.

@JakeAi
Copy link
Contributor

JakeAi commented Jun 20, 2022

@NathanWalker Whatever was updated since 3.0.14 kind of makes this unusable, especially without an example project.json. No matter what I do it runs a debug command, or I get an error for isUnitTesting or

The arguments 'C:\Program Files\nodejs\node.exe C:\Development\repo\node_modules\nx\bin\run-executor.js' are not valid for the current command.

@JakeAi I believe you got past that but ping back here if not.

nx run nativescript-monitor:build:prod --platform=android

―――――――――――――――――――――――― 🤖
Running NativeScript CLI within apps/nativescript-monitor

ns build android --no-hmr --env.uglify --env.production --for-device --release --key-store-path=E:\Development\Android\android.keystore --key-store-password=notforyou --key-store-alias=monitor --key-store-alias-
password=notforyou --env.replace="../../libs/data/default-env/src/lib/data-default-env.ts:../../libs/data/default-env/src/lib/data-default-env.prod.ts,./src/environments/environment.ts:./src/environments/environment.prod.ts" --force C:\Program Files\nodejs\node.exe C:\Development\minnich\node_modules\nx\bin\run-executor.js

Note: When using extra cli flags, ensure all key/value pairs are separated with =, for example: --provision="Name"

---
Error while loading nativescript-cloud is: Default commands should be required before child commands
The arguments 'C:\Program Files\nodejs\node.exe C:\Development\minnich\node_modules\nx\bin\run-executor.js' are not valid for the current command.
Run ns build android --help for more information.

@NathanWalker
Copy link
Contributor Author

@JakeAi can you run the following:

node -v
npm -v
ns -v

and paste the output here?

Then also can run:

npm install -g nativescript

And confirm version once more:

ns -v

@JakeAi
Copy link
Contributor

JakeAi commented Jun 20, 2022

@JakeAi can you run the following:

node -v
npm -v
ns -v

and paste the output here?

Then also can run:

npm install -g nativescript

And confirm version once more:

ns -v

v14.18.2
6.14.15
Error while loading nativescript-cloud is: Default commands should be required before child commands
8.2.3
√ Up to date.

Error while loading nativescript-cloud is: Default commands should be required before child commands
8.2.3
√ Up to date.

@NathanWalker
Copy link
Contributor Author

@JakeAi you will want at least node 15 or higher (we recommend 17 or 18).
Additionally you can run this command:

ns extension uninstall nativescript-cloud

That is an old and no longer used extension.

@JakeAi
Copy link
Contributor

JakeAi commented Jun 20, 2022

@JakeAi you will want at least node 15 or higher (we recommend 17 or 18). Additionally you can run this command:

ns extension uninstall nativescript-cloud

That is an old and no longer used extension.

I now get this


Note: When using extra cli flags, ensure all key/value pairs are separated with =, for example: --provision="Name"

---
node:events:505
      throw er; // Unhandled 'error' event
      ^

Error: spawn ns.cmd ENOENT
    at Process.ChildProcess._handle.onexit (node:internal/child_process:283:19)
    at onErrorNT (node:internal/child_process:478:16)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)
Emitted 'error' event on ChildProcess instance at:
    at Process.ChildProcess._handle.onexit (node:internal/child_process:289:12)
    at onErrorNT (node:internal/child_process:478:16)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  errno: -4058,
  code: 'ENOENT',
  syscall: 'spawn ns.cmd',
  path: 'ns.cmd',
  spawnargs: [
    'build',
    'android',
    '--no-hmr',
    '--env.uglify',
    '--env.production',
    '--for-device',
    '--release',
    '--key-store-path=E:\\Development\\Android\\android.keystore',
    '--key-store-password=',
    '--key-store-alias=monitor',
    '--key-store-alias-password=',
    '--env.replace="../../libs/data/default-env/src/lib/data-default-env.ts:../../libs/data/default-env/src/lib/data-default-env.prod.ts,./src/environments/environment.ts:./src/environments/environment.prod.ts"',
    '--force',
    'C:\\Program Files\\nodejs\\node.exe',
    'C:\\Development\\repo\\node_modules\\nx\\bin\\run-executor.js'
  ]
}

@NathanWalker
Copy link
Contributor Author

If you now run the following what versions do you have:

node -v
npm -v
ns -v

@JakeAi
Copy link
Contributor

JakeAi commented Jun 20, 2022

If you now run the following what versions do you have:

node -v
npm -v
ns -v

I'm currently dealing with npm/cli#4234
Ill let you know when I figure out how to fix it

@JakeAi
Copy link
Contributor

JakeAi commented Jun 20, 2022

node -v
npm -v
ns -v

This is the error. The previous error was related to that issue i linked.

The arguments 'C:\Program Files\nodejs\node.exe C:\Development\minnich\node_modules\nx\bin\run-executor.js' are not valid for the current command.
Run ns build android --help for more information.

v18.4.0
8.12.1
8.2.3
√ Up to date.

@NathanWalker
Copy link
Contributor Author

@JakeAi how about nx version as well? npx nx --version or yarn nx --version from root of your workspace.
Now that you have node updated you would likely benefit from doing a npx nx migrate latest and run through the steps to get on latest across the board.

@JakeAi
Copy link
Contributor

JakeAi commented Jun 21, 2022

@NathanWalker as of right now, 14.1.0.

Edit: now I can't build lol.

Edit 2: Updating ngtools webpack fixed the issue below. I still have The arguments C:\Program Files\nodejs\node.exe C:\Development\repo\node_modules\nx\bin\run-executor.js' are not valid for the current command.


C:\Development\repo\node_modules\typescript\lib\typescript.js:42537
        ts.Debug.assert(typeof typeReferenceDirectiveName === "string", "Non-string value passed to `ts.resolveTypeReferenceDirective`, likely by a wrapping package working with an outdated `resolveTypeReferenceDirectives` signature. This is probably not a problem in TS itself.");
                 ^

Error: Debug Failure. False expression: Non-string value passed to `ts.resolveTypeReferenceDirective`, likely by a wrapping package working with an outdated `resolveTypeReferenceDirectives` signature. This is probably not a problem in TS itself.
    at Object.resolveTypeReferenceDirective (C:\Development\repo\node_modules\typescript\lib\typescript.js:42537:18)
    at C:\Development\repo\node_modules\@ngtools\webpack\src\ivy\host.js:169:35
    at Array.map (<anonymous>)
    at host.resolveTypeReferenceDirectives (C:\Development\repo\node_modules\@ngtools\webpack\src\ivy\host.js:168:32)    at actualResolveTypeReferenceDirectiveNamesWorker (C:\Development\repo\node_modules\typescript\lib\typescript.js:116674:163)
    at resolveTypeReferenceDirectiveNamesWorker (C:\Development\repo\node_modules\typescript\lib\typescript.js:116974:26)
    at processTypeReferenceDirectives (C:\Development\repo\node_modules\typescript\lib\typescript.js:118456:31)
    at findSourceFileWorker (C:\Development\repo\node_modules\typescript\lib\typescript.js:118341:21)
    at findSourceFile (C:\Development\repo\node_modules\typescript\lib\typescript.js:118196:26)
    at processImportedModules (C:\Development\repo\node_modules\typescript\lib\typescript.js:118602:25)
    at findSourceFileWorker (C:\Development\repo\node_modules\typescript\lib\typescript.js:118347:17)
    at findSourceFile (C:\Development\repo\node_modules\typescript\lib\typescript.js:118196:26)
    at processImportedModules (C:\Development\repo\node_modules\typescript\lib\typescript.js:118602:25)
    at findSourceFileWorker (C:\Development\repo\node_modules\typescript\lib\typescript.js:118347:17)
    at findSourceFile (C:\Development\repo\node_modules\typescript\lib\typescript.js:118196:26)
    at processImportedModules (C:\Development\repo\node_modules\typescript\lib\typescript.js:118602:25)

Node.js v18.4.0

@NathanWalker
Copy link
Contributor Author

NathanWalker commented Jun 21, 2022

We sorted the above for @JakeAi it was related to some project.json setups and placement of options however also related to fact that keyStorePath flags should be passed in with the build command, for example:

nx run nativescript-app:build:prod --platform=android --keyStorePath="./my.keystore" --keyStoreAlias="alias" --keyStorePassword="pw" --keyStoreAliasPassword="aliasPw" --copyTo="./dist/build.apk"

@wearetelescopic
Copy link

Having the same issue - no matter what I run, nx build or nx run always results in a
ns debug

and then just opens the app on the phone again. How can one get to a production build??

@JakeAi
Copy link
Contributor

JakeAi commented Sep 8, 2022

Having the same issue - no matter what I run, nx build or nx run always results in a ns debug

and then just opens the app on the phone again. How can one get to a production build??

Use the 5.0 beta. It's much better.

@wearetelescopic
Copy link

Well I upgraded and yes, its not nicely building it. BUT, now its not running on the phone any more...any hints on how to get this going again?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants