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

Error: spawn nx ENOENT #4

Closed
hrueger opened this issue Sep 19, 2020 · 13 comments
Closed

Error: spawn nx ENOENT #4

hrueger opened this issue Sep 19, 2020 · 13 comments

Comments

@hrueger
Copy link

hrueger commented Sep 19, 2020

Overall the plugin-seed is working great.

However, I cannot publish the emoji-picker package, instead, the following error appears:

A:\_Source\nativescript-emoji-picker>npm run publish-packages

> @schoolsquirrel/[email protected] publish-packages A:\_Source\nativescript-emoji-picker
> nx g @nativescript/plugin-tools:publish

? Which packages � would you like to publish? [Type single name, comma separated list or hit enter for all] 
? What � version would you like to publish? [Type specific version or hit enter to auto bump the patch version] 
? Sanity check � Are you sure you have tested your local changes and want to publish? Yes


�  @schoolsquirrel/emoji-picker -- current: 1.0.0 > ⬆ bumping to: 1.0.1
build emitted error: Error: spawn nx ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
    at onErrorNT (internal/child_process.js:469:16)
    at processTicksAndRejections (internal/process/task_queues.js:84:21) {
  errno: 'ENOENT',
  code: 'ENOENT',
  syscall: 'spawn nx',
  path: 'nx',
  spawnargs: [ 'run', 'emoji-picker:build.all' ]
}
✅ Successfully built @schoolsquirrel/emoji-picker:1.0.1
build finished with code: -4058
spawn nx ENOENT
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @schoolsquirrel/[email protected] publish-packages: `nx g @nativescript/plugin-tools:publish`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the @schoolsquirrel/[email protected] publish-packages script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     A:\npm-cache\_logs\2020-09-19T11_52_51_551Z-debug.log

You can have a look at my workspace for reference: https://github.com/SchoolSquirrel/nativescript-plugins . Just run npm run publish-packages, type in emoji-picker and hit Enter twice.

The debug log looks like this:

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Users\\Hannes\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'run',
1 verbose cli   'publish-packages'
1 verbose cli ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prepublish-packages', 'publish-packages', 'postpublish-packages' ]
5 info lifecycle @schoolsquirrel/[email protected]~prepublish-packages: @schoolsquirrel/[email protected]
6 info lifecycle @schoolsquirrel/[email protected]~publish-packages: @schoolsquirrel/[email protected]
7 verbose lifecycle @schoolsquirrel/[email protected]~publish-packages: unsafe-perm in lifecycle true
8 verbose lifecycle @schoolsquirrel/[email protected]~publish-packages: PATH: C:\Users\Hannes\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;A:\_Source\nativescript-emoji-picker\node_modules\.bin;C:\Python27;C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\intel64_win\compiler;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\intel64_win\compiler;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\System32;C:\Windows;C:\Windows\System32\wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Qt\5.10.1\5.10.1\Src\qtbase\bin;C:\xampp\php;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\IVI Foundation\VISA\WinNT\Bin;C:\Program Files (x86)\GtkSharp\2.12\bin;C:\ffmpeg\bin;C:\Program Files\wkhtmltopdf\bin;C:\Program Files\Adobe\Adobe Photoshop CC 2017;C:\Users\Hannes\AppData\Local\Android\Sdk;C:\Program Files (x86)\Java\jre1.8.0_181\bin;C:\Program Files\Java\jdk1.8.0_191\bin;C:\Users\Hannes\AppData\Local\Android\Sdk\platform-tools;C:\ProgramData\chocolatey\bin;C:\Program Files\AdoptOpenJDK\jdk8u192-b12\bin;C:\Program Files\Java\jdk1.8.0_211\bin;C:\Users\Hannes\AppData\Local\Android\Sdk\tools;C:\Program Files\Microsoft Network Monitor 3\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\dotnet\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Windows\System32;C:\Windows;C:\Windows\System32\wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\GnuPG\bin;C:\Program Files\PuTTY\;E:\Virtualbox;E:\Docker Toolbox;C:\Program Files\OpenSSL-Win64\bin;C:\Program Files (x86)\GnuWin32\bin;C:\Program Files\nodejs\;C:\Users\Hannes\AppData\Local\Programs\Python\Python38\Scripts;C:\Users\Hannes\AppData\Local\Programs\Python\Python38\Scripts\;C:\Users\Hannes\AppData\Local\Programs\Python\Python38\;C:\Users\Hannes\AppData\Local\Microsoft\WindowsApps;C:\Users\Hannes\AppData\Local\ComposerSetup\bin;C:\Users\Hannes\AppData\Roaming\Composer\vendor\bin;C:\Users\Hannes\AppData\Local\Programs\Git\cmd;C:\Users\Hannes\go\bin;C:\Users\Hannes\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\Hannes\AppData\Local\Microsoft\WindowsApps;C:\Users\Hannes\AppData\Roaming\npm;C:\Program Files (x86)\GitHub CLI\
9 verbose lifecycle @schoolsquirrel/[email protected]~publish-packages: CWD: A:\_Source\nativescript-emoji-picker
10 silly lifecycle @schoolsquirrel/[email protected]~publish-packages: Args: [ '/d /s /c', 'nx g @nativescript/plugin-tools:publish' ]
11 silly lifecycle @schoolsquirrel/[email protected]~publish-packages: Returned: code: 1  signal: null
12 info lifecycle @schoolsquirrel/[email protected]~publish-packages: Failed to exec publish-packages script
13 verbose stack Error: @schoolsquirrel/[email protected] publish-packages: `nx g @nativescript/plugin-tools:publish`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (C:\Users\Hannes\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:315:20)
13 verbose stack     at ChildProcess.<anonymous> (C:\Users\Hannes\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:315:20)
13 verbose stack     at maybeClose (internal/child_process.js:1021:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
14 verbose pkgid @schoolsquirrel/[email protected]
15 verbose cwd A:\_Source\nativescript-emoji-picker
16 verbose Windows_NT 10.0.19041
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Hannes\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run" "publish-packages"
18 verbose node v12.18.2
19 verbose npm  v6.14.6
20 error code ELIFECYCLE
21 error errno 1
22 error @schoolsquirrel/[email protected] publish-packages: `nx g @nativescript/plugin-tools:publish`
22 error Exit status 1
23 error Failed at the @schoolsquirrel/[email protected] publish-packages script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

As you can see, I'm using Windows 10. I also tried installing nx globally but this didn't change anything.

@hrueger
Copy link
Author

hrueger commented Sep 23, 2020

@NathanWalker any idea? Sorry for another ping, but this is really preventing me from publishing my plugin...

@NathanWalker
Copy link
Contributor

@hrueger thanks for this - appears could be a Windows difference with the node spawn handling. No worries though I'll look into that but here's what you can always do (the publish workflow is just a nicety but you can always do it directly):

  • npm start > build your plugin via it's command listed
  • cd dist/packages/{your-package} and then you can simply publish: npm publish --access public

The --access public flag is only needed when publishing a brand new package to npm. It can be omitted in subsequent versions.

@hrueger
Copy link
Author

hrueger commented Sep 23, 2020

@NathanWalker Thank you, publishing the package manually worked perfectly.

@NathanWalker
Copy link
Contributor

‘npm run publish-packages’ has been fixed for this case in latest version of the tools. As long as using a tilda ‘~’ on the tools version in your plugin workspace, will pick them up when running a ‘npm run setup’ to clean your workspace again.

@hrueger
Copy link
Author

hrueger commented Oct 18, 2020

@NathanWalker Thanks, but it's still not working, I get the same error. I have "@nativescript/plugin-tools": "~1.0.6", in my package.json and ran npm run setup. I also tried removing the whole project folder and cloning it again but it's still not working.

@NathanWalker
Copy link
Contributor

Ok thanks - let's reopen and if any Windows users out there can post a PR would be appreciated - probably path separator needs another adjustment.

@NathanWalker NathanWalker reopened this Oct 18, 2020
@NathanWalker
Copy link
Contributor

@hrueger posted you PR which I believe will fix it for you. Could you merge and give a build on your Windows setup?
If this confirmed works I'll add a migration to update for other workspaces whom experience similar issue on Windows.
SchoolSquirrel/nativescript-plugins#47

@NathanWalker
Copy link
Contributor

Sounds like that may not totally fix it for you - this is related to #8 where some similar investigations are occurring from that reporter as well.

@hrueger
Copy link
Author

hrueger commented Oct 25, 2020

@NathanWalker Sorry for the late reply. Unfortunately, your PR doesn't change anything. I still get the same error message.

@NathanWalker
Copy link
Contributor

@hrueger a contributor just helped find the cause on Windows and Pr'd the fix. For you workspace just open workspace.json and find the "all" project and update "root" to have a trailing slash:
before:

"all": {
  "root": "packages",

after:

"all": {
  "root": "packages/",

@NathanWalker
Copy link
Contributor

I went ahead and pushed up to existing pr to include that final fix as well:
SchoolSquirrel/nativescript-plugins#47

@hrueger
Copy link
Author

hrueger commented Oct 25, 2020

@NathanWalker thanks, I'll test and merge it tomorrow.

@hrueger
Copy link
Author

hrueger commented Oct 26, 2020

@NathanWalker SchoolSquirrel/nativescript-plugins#47 did solve the build problem, but not this issue.
However, I have found a solution: According to this StackOverflow answer it is caused by some missing extension. Adding shell: true to the options of the spawn calls solves it for me.

I created a PR: NativeScript/plugin-tools#1

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

2 participants