Gulp not working with GitLab runner - powershell

I want to get a GitLab runner to work on my laptop (Windows 10) but it does not execute the gulp commands, because "gulp" is not recognized as a script.
This is my .gitlab-ci.yaml
before_script:
- npm install -g gulp-cli
- npm install
cache:
paths:
- node_modules/
stages:
- build
building:
stage: build
tags:
- onpremise
script:
- gulp build
The relevant settings of my config.toml
executor = "shell"
shell = "powershell"
(If I set shell to "cmd" then gulp build is not called at all.)
And the output of my build job in GitLab
$ npm install -g gulp-cli
C:\USERS\_SYSTEM\AppData\Roaming\npm\gulp ->
C:\USERS\_SYSTEM\AppData\Roaming\npm\node_modules\gulp-cli\bin\gulp.js
+ gulp-cli#2.0.1
updated 1 package in 7.67s
$ npm install
up to date in 11.609s
$ gulp build
gulp : The term "gulp" is not recognized as cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

I don't have enough points to comment, so please forgive the guess. I'm suspecting $env:path for your working powershell session is different from the $env:path that your gitlab runner is getting.
You could confirm this by comparing the two by adding $env:path.split(";") to your build script and comparing the output to your working powershell session.
You can also run get-command gulp | select source in the session that works, to locate the gulp file (on my server it's a .cmd file in a personal folder) . You should then be able to add $env:path = $env:path + ";C:\path\to\that\folder" near the top of the build script to resolve the path issue I'm suspecting you have.
Additionally, you may need to install gulp globally if you have not already done so. See https://stackoverflow.com/a/37287770/7674011

Try adding - npm install --save-dev gulp after - npm install -g gulp-cli.

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

trying to install next js on VS code but show error by saying npm not recognized

I am trying to install next js in VS code, when I type 'npx create-next-app' in the powershell terminal in VS, it showed error by saying:
The term 'npx' is not recognized as the name of a cmdlet, function, script file, or operable program.Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
I have already install node 10.13 like the documentation of next asked me to...
Here is a picture
It means npx is not installed in your machine please check or update your npm or installed npx first.
use this cmd to check if it is installed or not npx --version if not then update your node and npm version
as in your attachment, you did not pass the project name as you should provide the project name as well npx create-next-app myapp
When installed, try
npx create-next-app [name here]
cd my-project
Install node.js, helped me. Then check version. npx -v, then install it npx create-react-app my-app for example

'ANY_NODE_APP' is not recognized as an internal or external command, operable program or batch file on windows 10

I use windows 10 OS . I already try :
npm i -g tslint
also local install.
I use visual code terminal (power shell , git bash and cmd ) no help in any variant.
Where is the execution file for tslint ? I will put path intro the PATH env var.
It is probably caused by the version conflict between global and project's TsLint. You can see your version by: tslint -v
Then you can reinstall Tslint globally to latest version by:
npm install tslint typescript -g
Then use following command in your project directory to even up versions.
npm install tslint typescript --save-dev
And also you can search in your json files if there is a specification about Tslint version.

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.

ionic is not recognized as an internal or external command operable program or batch file

I have tried to install ionic framework. I was done with my first step by executing the command (installed node.js).
First command: npm install -g cordova ionic
But the second command is not executing instead stating"ionic is not recognized as an internal or external command operable program or batch file "
Second command:ionic start myApp tabs
I request to help me out
I'm using windows 10 for developing, I solved it by adding the npm global packages folder:
%USERPROFILE%\AppData\Roaming\npm
to the environment variable Path
I assume you are trying to install ionic in windows.
I think you could try to install it alone, without cordova, and then try it again.
npm install -g ionic
Regards
İf "ionic" is installed;
1-Download and upgrade nodejs to latest version.
download nodejs
2- run command:
npm uninstall -g ionic
3-Clear these files:
C:\Users\user\AppData\Roaming\npm
C:\Users\user\AppData\Roaming\npm-cache
3-run command:
npm install -g #ionic/cli
İt is done:)
SET PATH=C:\Program Files\Nodejs;%PATH%
Is worked for me on Windows 10 :)