Steps to reproduce:
1. Install studio versions mentioned in environment.
2. After studio launches wait till it checks available update.
3. Make sure you already have appc CLI installed.
Actual result:
1. Studio will show update available for CLI with version
N/A
.
2. Clicking install will error with:
!ENTRY com.aptana.core 1 0 2018-06-27 13:30:21.261
!MESSAGE (Build 5.1.0.201806130735) [INFO] com.aptana.core/debug/shell/output Process Error Output:
module.js:538
throw err;
^
Error: Cannot find module 'chalk'
at Function.Module._resolveFilename (module.js:536:15)
at Function.Module._load (module.js:466:25)
at Module.require (module.js:579:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (C:\Users\Tester\AppData\Roaming\npm\node_modules\appcelerator\bin\appc:11:13)
at Module._compile (module.js:635:30)
at Object.Module._extensions..js (module.js:646:10)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
at Function.Module._load (module.js:489:3)
3. This messes up the installed appc cli installation on my machine & now running
appc -v
gives me the error above.
4. Also because of this what I am seeing is my android SDK on the dashboard does not get detected even though studio platform config shows everything is fine. I also see the error in studio console below:
["Unable to set property 'sdkInfo' of undefined or null reference","https://appc-studio.appcelerator.com/?p=W&fg=000000&uid=null&bg=ffffff&ch=f0f0f0&v=5.1.0.201806130735&id=e5bfbe3c-fb49-4c5c-b8ba-2367290df534&subscription=-1&nl=en_US&ts=1530134459624",198]
Expected results:
1. Studio should not prompt for appc CLI update when latest CLI version is already installed.
I experienced the same issue but with a different module error. {noformat} C:\Users\Josh\appc\test4>appc info module.js:538 throw err; ^ Error: Cannot find module 'npm-install-checks' at Function.Module._resolveFilename (module.js:536:15) at Function.Module._load (module.js:466:25) at Module.require (module.js:579:17) at require (internal/module.js:11:18) at Object.
I tried reproducing this issue on Windows 10, with no CLI-7.0.4 installed. CLI installation always hangs for me, while fetching appcd module. Of the 5 attempts I made (both using windows command utility and using Studio), it always gets stuck on fetching appcd. This for sure has got nothing to do with Studio, but an issue in installing dependent modules. Will try using a different internet connection and see if it goes through.
Could not reproduce with following scenarios: Env: OS: Win 10Pro Studio: 5.1.0.201806130758 (32 bit and 64 bit) SDK: 7.2.0.GA Appc CLI: 7.0.4 JDK: 9.0.4, 10.0.1(64 bit) and 1.8.0_131(32 bit) Node: 8.9.1 NPM: 5.5.1, 6.1.0 1. Deleted all instance of appc core and npm installation from the system. Studio installer installed the 7.0.4 CLI. Upon launch and re-launch it did not prompt for CLI update. 2. Again deleted all instance of appc core and npm installation from the system. Installed appc npm and core from command line. Installed studio. No CLI update shown upon studio launch 3. With APPC CLI 7.0.2 already installed. Installed studio. Upon launch there was a prompt shown for CLI 7.0.4 update available. Updated CLI from studio. Again checked for updates. No updates shown. Restart studio. No updates shown
I guess the first issue I mentioned was due to network. I could install CLI 7.0.4 via windows cmd util and via studio. The Studio updater too worked fine for me, using npm 5.5.1 and 6.1.0, on Studio RC 5.1.0.201806130758. Trying to see if we can break installed 7.0.4 CLI such that I get a pop-up on Studio to install 7.0.4. Will update my findings as soon as I succeed in reproducing this exact case.
I tried reproducing the issue by deleting few files from the installed CLI 7.0.4 such that Studio finds the installed 7.0.4 missing. When I chose to update/install 7.0.4 from Studio, it did install CLI 7.0.4 without any issue in downloading/installing node modules. I suspect that, it could be an issue with npm installation while node package manager tried to fetch those modules (chalk and npm-install-checks). And its intermittent. [~fmiao], could you please take a peek?
[~ppedduri] I am intermittently getting the issue but only when installing studio, I seem to get the error around 20% of the time, I just got it again. !install.PNG|thumbnail! I have the latest tools installed but studio is still trying to install the CLI
[~jlongton], any issue installing/using CLI through command line on Windows?
[~jlongton]/[~lchoudhary], please try installing CLI 7.0.4 via CLI and let us know your observations. Since this issue is intermittent, please run the installation/uninstallation multiple times to see if you fall in same npm installation issue for modules *chalk* and *npm-install-checks*
[~fmiao] I just checked on the PC on which [~lchoudhary] was facing the issue. The same issue actually is shown even when trying to use appc commands from terminal.
Hence when we check for updates in studio it tries to run appc command in the background and the error is returned.
[~ssekhri], from the error, it looks like a broken installation of appc npm. Try reinstalling the npm module.
npm install appcelerator -g
.[~fmiao], [~ppedduri], I only ever experienced this issue when the appc npm was installed with the studio installer, I already had GA but studio is persistent that it is unable to find it and installs it anyway. I don't know if this could be why the module is not installed correctly.
[~jlongton], Were you able to run through multiple attempts to install CLI 7.0.4 via terminal(cmd util) and it succeeds always w.r.t. appc npm installation?
[~ppedduri] Yes I was able to install the CLI multiple times and appc npm multiple times successfully from cmd, from what I am seeing it is an issue with studio installing the appc npm, I am not able to reproduce this issue other than using studios installer.
[~jlongton], thanks for confirming that. Sorry that I had to ask you as we couldn't reproduce this issue locally, with many attempts. We will further look into this issue and update here.
[~fmiao],[~ssekhri], [~ppedduri], [~jlongton]'s comment above exactly describes what happens. The appc npm installation gets broken yes but only when studio installs it during the studio installation where it forces you to install appc npm even though installed. To get out of the broken stage uninstalling & installing appc npm is the only way I have seen which has to be done manually.
[~ssekhri] and I just happened to run these scenarios again, with and without 7.0.4 preinstalled and still fail to reproduce this exact issue. For us, post successful Studio installation it doesn't prompt any update of CLI if 7.0.4 is already available on the machine. And each installation of Studio succeed in installing appcelerator npm, with all dependent modules installed correctly. [~lchoudhary], [~jlongton] - in order for us to verify what's causing this issue on your machine (rather, what we are missing) we would need access to your machine. Please let us know if we can get into a WebEx call. Studio windows-installer invokes the following 2 commands and doesn't seem like causing any breakage * npm install -g appcelerator * appcelerator use latest
Thanks for sharing system credentials [~lchoudhary]. This surely helped us narrow down the issue. I confirm that the issue is not with Appcelerator Studio, but with appc npm. Please follow below steps to reproduce the issue on shared windows machine. * make sure appc npm is clean. if you see errors the output of command *_$npm ls -g_*, please run *_$npm install -g appcelerator_* and be sure that *_npm ls -g_* doesn't show any errors * verify that npm is clean, with any appc command. (I 've used a simple *_$appc_* command and it worked fine) * now run the command *_$npm install -g appcelerator_* again and observe the output (It updates 1 package and adds 1 package this time) * run any appc command --> it now fails with the same error related to the module '*_chalk_*' ---- The following sequence of commands that I ran (and the respective output) might help in understanding the above steps. {quote}C:\Users\Tester\AppData\Roaming\npm>appc module.js:538 throw err; ^ Error: Cannot find module 'chalk' at Function.Module._resolveFilename (module.js:536:15) at Function.Module._load (module.js:466:25) at Module.require (module.js:579:17) at require (internal/module.js:11:18) at Object.
[~eharris] If you have cycles would you be able to look at this? It seems to be an appc npm bug on Windows only.
I'm struggling to reproduce this, but I'm familiar with the error having seen it on other globally installed packages I use across OSX and Windows when running
npm install <package> -g
when I already have the same version of the package installed (which seems to lead to npm re-sorting the package structure or nuking packages for no reason) I would not classify this as an error of ours or of the appc cli, it's an error of npm as it controls the validity of that package. There's a few things we could maybe do to "fix" this ourselves, in no order:Publish a shrinkwrap with appc-install and hope that npm respects it (I wouldn't really want to do this)
Upgrade the version of node (and subsequently npm) distributed in Studio, anecdotally I've only ever seen this when using a 5.5.X npm, it's possible the problem doesn't occur in the newer version of npm distributed. An upgrade to 8.10.0 gets us 5.6.0 npm, where this issue might be alleviated.
Studio only installs the cli components when it knows an upgrade is there for sure (TISTUD-8645), probably not worth the engineering effort
We document as a known issue with instructions of how to fix manually
Studio handles that error and attempts to reinstall the package for a user
Same problem persists now, with Studio 6.0.0.0. @Ewan Harris, what are the instructions for fixing this manually?
npm ls -g
yields this output: C:\Users\Shawn.Lipscomb\AppData\Roaming\npm-- appcelerator@5.0.0 +-- ansi-regex@0.2.1 +-- ansi-styles@1.1.0 +-- assert-plus@1.0.0 +-- UNMET DEPENDENCY async@^1.5.0 +-- asynckit@0.4.0 +-- aws-sign2@0.7.0 +-- aws4@1.10.1 +-- bytes@3.1.0 +-- caseless@0.12.0 +-- UNMET DEPENDENCY chalk@0.5.1 +-- chownr@1.1.4 +-- co@4.6.0 +-- UNMET DEPENDENCY debug@^2.1.1 +-- UNMET DEPENDENCY npm-install-checks@^3.0.0 +-- UNMET DEPENDENCY pac-proxy-agent@^3.0.0 +-- UNMET DEPENDENCY progress@1.1.8 +-- UNMET DEPENDENCY request@^2.87.0 +-- UNMET DEPENDENCY semver@^6.0.0
-- UNMET DEPENDENCY tar@^4.4.4 npm ERR! missing: async@^1.5.0, required by appcelerator@5.0.0 npm ERR! missing: chalk@0.5.1, required by appcelerator@5.0.0 npm ERR! missing: debug@^2.1.1, required by appcelerator@5.0.0 npm ERR! missing: npm-install-checks@^3.0.0, required by appcelerator@5.0.0 npm ERR! missing: pac-proxy-agent@^3.0.0, required by appcelerator@5.0.0 npm ERR! missing: progress@1.1.8, required by appcelerator@5.0.0 npm ERR! missing: request@^2.87.0, required by appcelerator@5.0.0 npm ERR! missing: semver@^6.0.0, required by appcelerator@5.0.0 npm ERR! missing: tar@^4.4.4, required by appcelerator@5.0.0[~bitshftr] I _think_ reinstalling the
appcelerator
usingnpm i -g appcelerator
npm package should fix that error. If that still fails, reinstall Node (I recommend 12.x if you're using newer SDKs i.e. 9+, 10.x if you're still rocking 8.x) and retry