call vscode extension activation script from command line - visual-studio-code

I am trying to bundle the completely installed version of vsliveshare. To do that, I have to run the extension activation once because that downloads & installs additional files into the extension folder.
Now my instinct was to just run
% echo "require('./out/src/extension').activate()" | node
but that does not work out:
module.js:549
throw err;
^
Error: Cannot find module 'vscode'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
...
I've done a npm install and the vscode module is present in node_modules.
Is there any trick I can use to get this to execute from the command line without having to run vscode itself?

Related

Can't build Visual Studio Code source - "Error: Cannot find module 'gulp-bom'"

I am trying to build Visual Studio Code so the dependencies are compiled in (can't install rpm packages as I don't have root). I have worked through a few issues so far, but I can't figure out why I am getting the following error.
[mrhicks#xxxxxx repo]$ yarn run watch
yarn run v1.12.3
$ gulp watch --max_old_space_size=4095
[20:28:22] Node flags detected: --max_old_space_size=4095
[20:28:22] Respawned to PID: 27503
module.js:550
throw err;
^
Error: Cannot find module 'gulp-bom'
at Function.Module._resolveFilename (module.js:548:15)
at Function.Module._load (module.js:475:25)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/users/mrhicks/projects/vscode/repo/build/lib/compilation.js:10:13)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
I have make sure to re-run sudo npm install to try and ensure everything for npm is installed. I have been following the instructions from the VSCode site here
I had this locally. It went away after yarn add gulp-bom --no-save. 🤷‍♂️
If you applied the changes at https://github.com/addaleax/natives/commit/0abbec6b0e211c6bbe3bf0d2b33fcd68f5a6c980, you'll need to re-apply them after.

Error: Error: Cannot find module 'cucumber'

I am trying to execute a small example of automated test using Webstorm, cucumber and protractor.
I have already installed cucumber using this command within the root of the project:
sudo npm install -g cucumber
I have already created the conf.js file and when running this command within the prompt:
> protractor conf.js
Finally, the output is:
*
[13:13:18] E/launcher - Error: Error: Cannot find module 'cucumber'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.module.exports.load (/Users/alfredo.bazo/node_modules/protractor-cucumber-framework/lib/cucumberLoader.js:19:24)
at Object.<anonymous> (/Users/alfredo.bazo/node_modules/protractor-cucumber-framework/index.js:8:33)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
[13:13:18] E/launcher - Process exited with error code 100
I have no idea what else I can do, any suggestions?
There are two approach to resolve your problem, and recommend to use approach 1).
1) install cucumber as project local package, rather than global package.
npm install -S cucumber
2) install cucumber as global package, and you need to add below Environment variable to tell node.exe where to find and load global package.
NODE_PATH=<npm global package install folder path on your machine>
you can execute npm config get prefix which will print out the global package install folder path.
Important: After add environment variable, you need to try in new opened cmd/terminal window.
how to overcome this :try to share video please regarding this query : ...
install cucumber as global package, and you need to add below Environment variable to tell node.exe where to find and load global package.
NODE_PATH=
you can execute npm config get prefix which will print out the global package install folder path.
Important: After add environment variable, you need to try in new opened cmd/terminal window.

Bluemix Securegatway Installation Error on Windows Server 2012 R2

Installation goes through fine but we keep on getting this error message once launching the client's UI:
The command is: node lib\secgwclient.js cEm9COT0o411_prod_ng --1 INFO --P 9003 module.js:457
throw err;
Error: Cannot find module 'log4js'
at Function.Module.resolveFilename (module.js:455:15)
at Function.Module._load (module.js:403:25)
at Module.require (module.js:483:17) at require (internal/module.js:20:19)
at Object.<anonymous> (C:\Program Files (x86)\Secure Gateway Client\ibm\securegateway\client\lib\utils\logging.js:26:18)
at Module._compile (module.js:556:32)
at Object.Module._extensions..js (module.js:565:10)
at Module.load (module.js:473:32)
at tryModuleLoad (module.js:432:12)
at Function.Module._load (module.js:424:3)
The error is complaining about log4js module Cannot find log4js module. I tried manually installing the log4js modue using npm, but the error persists.
This issue usually indicates that the install is behind a firewall or proxy which caused the npm install to fail. Does the machine have outbound access to npmjs.com:443?
You can either re-install the client or run npm install from the client folder. If npm is not a globally recognized command, you will need to provide the path to npm that is packaged with the node version contained within the installation folder.

Aurelia build on VSO Hosted Build Controller

I am trying to get a build going for Aurelia on VSO Hosted Build Controller. I created a small powershell script to run the following commands
npm install
.node_modules/.bin/jspm cc
.node_modules/.bin/jspm install -y
.node_modules/.bin/gulp build
I do have AfterBuild targets to copy the jspm_packages and dist folders to my _publishedWebsites folder.
npm install runs fine, but when it comes to jspm cc (if I remove the jspm cc and let it run jspm install -y), it fails trying to this
jspm cc
Migrating global jspm folder from C:\Users\buildguest\.jspm to C:\Users\buildguest\AppData\Local\.jspm...
Copying configuration...
err Error migrating to new jspm folder
2>EXEC : error : ENOENT, no such file or directory 'C:\Users\buildguest\.jspm\config' [d:\a\src\WebGUI\OwinAureliaScaffold\OwinAureliaScaffold.csproj]
at Object.fs.openSync (evalmachine.<anonymous>:427:18)
at Object.fs.readFileSync (evalmachine.<anonymous>:284:15)
at Object.<anonymous> (d:\a\src\WebGUI\OwinAureliaScaffold\public\node_modules\jspm\lib\global-config.js:36:24)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (d:\a\src\WebGUI\OwinAureliaScaffold\public\node_modules\jspm\lib\registry.js:19:20)
ok Loader file cache cleared.
ok Package cache cleared.
I do understand the jspm is not installed globally, since it is a hosted controller, I cannot really install it globally. My question is, how do I work through this without having a global jspm install? Is there a workaround where it does not have to migrate the config file?
Even though you cannot install and run the jspm CLI on the hosted build agent, you can run jspm through node itself.
First, make sure jspm is installed - which your powershell script does. Alternatively, you can use VSO Build's "npm install task", provided jspm is in your package.json file.
I used Gulp to execute jspm through node. I'm not sure if that's the best way to do this step, but it works... I used VSO's "Gulp task"
Here are the relevant bits from gulpfile.js:
var gulp = require('gulp'),
exec = require('child_process').exec;
//#region Build Tasks
gulp.task('build:jspm', function (cb) {
exec("node ./node_modules/jspm/jspm.js install", function(err, stdout, stderr) {
console.log(stdout);
console.error(stderr);
cb(err);
});
});
gulp.task('_build', ['build:jspm']);
I do understand the jspm is not installed globally, since it is a hosted controller, I cannot really install it globally.
It appears that this is not true (at least currently.) You can install jspm globally on a hosted controller.
I was able to solve this with a build process that looks like this:
npm install
npm install -g jspm
node C:\NPM\Modules\node_modules\jspm\jspm.js install
1) Installs all of the local dependencies from my package.json. 2) Installs a global version of JSPM 3) Evokes it from the global installation location
I realized from M Falanga's answer that node was obviously in the controller's path so I could call it from Powershell/command line. The global JSPM install location I found from looking at the build's debug logs. Note to implementors, you'll want to make sure your working directory for steps 1 and 3 are set to where your package.json is located.
Alternative Solution
I have not tested this next option in a build yet but you should be able to skip the extra build steps and just use the scripts feature of NPM to do the JSPM install. In this case you won't need the NPM install step nor the Run node step above.
In your package.json you'll need the following script entry:
"keywords": [...],
"scripts": {
"postinstall": "./node_modules/.bin/jspm install -y"
},
"jspm": {...
If administrative privileges are required on the computer to install a package, there's no way for you to do it in hosted build. You will have to create your own build machine in this case. It's something we hope to solve in the future.
That said, here's what one person did to get Aurelia set up: http://fabhojs.blogspot.com/2015/03/aurelia-app-skeleton-yeoman-generator.html (from this question). Those steps are different and may help.

protractor cant find cli.js file

I just installed protractor and the default repo along with webdriver. Every time I run protractor I get this error
module.js:340
throw err;
^
Error: Cannot find module '/usr/local/lib/node_modules/protractor/lib/cli.js'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:901:3
Not sure how to fix this... any clues?
Try to use the following solution :
under Configuration , use this for javascript file = /usr/lib/node_modules/protractor/lib/cli.js
I faced similar issue , it got resolved . I am using WebStorm in linux environment .
Make sure you installed protractor on the global position , by using this command :
sudo npm install -g protractor
sudo webdriver-manager update
webdriver-manager start
Got stuck similarly ... this worked for me.
Make sure to have "node_modules" & "node_modules/.bin" in the project folder, you can generate them by
running "npm install protractor" on the project root folder and then get rid of it "protractor" folder by running "npm uninstall protractor".