VSTS Build is failing with Polymer build - azure-devops

I am running npm,lerna,yarn and bootstrap in my VSTS build definitions via Command line task after running all the above commands I am running npm run build command but while running npm run build command its failing with 'polymer' is not recognized as an internal or external command.Please help me on this.I tried running polymer in a command line passing polymer as a tool and arguments as build even though its failing.Please help me.

Make sure that the polymer-cli npm package is listed in your dev dependencies (at least it sounds like a dev dependency to me) in your package.json. Also make sure you run npm install before you run npm run build. You might have to point your NPM build script to the Polymer package in your node_modules folder because it is not installed globale on the build server

Related

How do I run an npm script directly in VS code terminal

I am trying to follow this MS tutorial.
So I install the CLI from the VS code terminal: npm install #azure/static-web-apps-cli
Works.
But following the instructions using "swa init" in the terminal I get this response:
swa : The term 'swa' is not recognized.... etc.
Adding the command to package.json as a script will work, but how do I run it directly from the terminal without adding it to package.json?
npx swa init would pull the swa package and execute it as if it was run from within package.json. You can read more about it on npmjs.com/package/npx
Alternatively, you could have the swa package installed globally with npm i -g #azure/static-web-apps-cli

code ship fails with error - You have to be inside an angular-cli project in order to use the serve command

For my angular CLI/Bitbucket project I am running following script in Codeship but it gives error You have to be inside an angular-cli project in order to use the serve command.
#install node version, 4.x is required for the angular-cli
nvm install 4.1
#install angular-cli
npm install angular-cli
#run npm install for your project dependencies
npm install
Under that script is the "Test Pipelines", where the script is setup to run the tests.
#serve the application adding '&' to run command in background
ng serve &
#start end to end tests using protractor
ng test
#if all of the tests pass, then build the production assets
ng build -prod
According to https://github.com/angular/angular-cli/issues/4379 this error message is usually triggered if you're using the (now deprecated) angular-cli package.
Either update the package.json file for the project to reference the #angular/cli package, or make sure to install this package instead of the deprecated one.

How do I run protractor from source code

I cloned the protractor code from github (https://github.com/angular/protractor)
Is there a way to run the code from the source code? The documentation is always mentions to install protractor with "npm install", but I want to run the latest code.
Is there an easy way to do this ?
npm install in this context is meant to install the local dependencies for protractor.
You need to just run the protractor script in the bin folder.
git clone https://github.com/angular/protractor.git
cd protractor
npm install
cd bin/
./protractor /path/to/e2e/e2e-conf.js

Why can't TeamCity run this Rake build using Albacore?

I created a build script using Rake & Albacore which builds a solution and executes unit tests. I am trying to set it up in TeamCity. I am getting this error.
Cannot start build runner: If you wan't to use bundler please install
it at first. The gem wasn't found in Gem paths of Ruby SDK with
interpreter: 'C:\Ruby187\bin/ruby.exe'.
Hide stacktrace
jetbrains.buildServer.agent.rakerunner.RakeTasksBuildService$MyBuildFailureException:
If you wan't to use bundler please install it at first. The gem wasn't
found in Gem paths of Ruby SDK with interpreter:
'C:\Ruby187\bin/ruby.exe'. Gem paths: C:/Ruby187/lib/ruby/gems/1.8
C:/Users/af/.gem/ruby/1.8
I added one parameter, where Albacore is installed. But, I am still getting the error.
GEM_PATH=C:\Ruby187\lib\ruby\gems\1.8\gems\albacore-0.3.4\albacore.gemspec
Ok finally was able to resolve the problem. I simply created a batch file that executes the rake task and instead of using "Rake Build Step" in Team city; used the command line build step and executed the batch file. It also gives me complete log of all the build steps, tests run etc.
Hopefully this will help someone else too. You don't need to setup a Rake Build Step as it turns out.
It's not clear that Albacore was missing. The error message indicates that TeamCity cannot find Rake itself!
Cannot start build runner
What was the exact Rake task configuration? Specifically the Ruby Interpreter configuration section? You can tell TeamCity exactly which Ruby to run, which will affect which gems are available (and Rake is just a gem).
It looks like you have a Ruby 1.8.7 installed and that you must have installed Albacore
cmd> gem install albacore
Do you also have Rake installed? In Ruby 1.8.7, the Rake gem was not included by default. You can list the machine's installed gems by
cmd> gem list --local
You'll should install Rake.
cmd> gem install rake
I'm not actually sure how you ended up getting this to work. What's the contents of the batch file? Do you have any other Ruby/Rake installed?

`npm install <folder>` or `npm pack` does not install dependencies

I have an npm package that uses coffeescript source, which I want to precompile before pack or publish. However, my prepublish script depends on coffee-script as a devDependency, but npm isn't installing it before running the prepublish action. I have to run npm install separately first, which seems wrong. The same issue exists if I try to npm install the source folder into a different project.
I suspect that I'm "doing it wrong," but the only other guidence I've seen is to compile on install rather than publish. I'd rather not do that, so I'm hoping there are examples of prepublish compilation that I can crib from.