How to ignore npm run errors and keep going on Travis-CI? - npm

I have stage in Travis config that launch npm run build where the build is a script converting ts -> js. Locally, it returns two errors that doesn't matter anything, I can run a server anyway. But, these errors stop Travis moving on and fails.
- stage: "Build front"
before_script:
- cd front
- npm install
- npm run build
The error:
...
[0] npm run build:client exited with code 0
build/setupProdServer.ts(6,20): error TS2307: Cannot find module '../src/vue-ssr-server-bundle.json'.
build/setupProdServer.ts(7,28): error TS2307: Cannot find module '../src/vue-ssr-client-manifest.json'.
npm ERR! code ELIFECYCLE
npm ERR! errno 2
...
I tried add
allow-failures:
- node
- npm
and it not helped.
I need Travis ignore these errors and move to the next stage.
What kind of commands or parameters in Travis will solve it?

Just add || true:
- npm run build || true

Related

NPX command not running in Azure pipeline

I need your help
I was trying to run my cypress test cases which I generally run using command
"npx cypress run"
so I tried to have the same command in tasks when I created Azure pipeline
after NPM Install
I even tried installing npx via
npm task and custom command "npm install nx"
and this causing the below issue so can anyone suggest to me how to proceed in this case
"##[warning]Couldn't find a debug log in the cache or working directory
##[error]Error: Npm failed with return code: 1
"
From the error screenshot, it shows that you are using the Npm Task and running the command: npm npm install nx.
The command is invalid.
To solve this issue, you need to remove the npm in the NPM task -> Command and arguments .
Refer to the following sample:
YAML Pipeline:
- task: Npm#1
displayName: 'npm custom'
inputs:
command: custom
verbose: false
customCommand: 'install nx'
Classic Pipeline:

Why is npx not finding the package.json in the parent directory?

The Goal: 'npx elm make' running successfully in a GitLab CD
Background: I have a bit of a toy frontend project on GitLab pages, and I've written a crude CI/CD pipeline for it. This includes building a subdirectory with elm files. It worked for a while and then suddenly broke, and I can't seem to fix it.
The script is as follows:
cd public/scripts/
npm i
cd elm/
npx elm make src/Main.elm --output=index.js
and then continues with the rest of the script.
These instructions work fine on my machine.
The issue: 'npx elm make' looks for a package.json in the elm directory.
Here is the output from the failed build:
Running with gitlab-runner 13.5.0-rc2 (71c90c86)
on docker-auto-scale z3WU8uu-
Resolving secrets
00:00
Preparing the "docker+machine" executor
Using Docker executor with image node:latest ...
Pulling docker image node:latest ...
Using docker image sha256:ca36fba5ad66b0f8fce2b97a6f0aa53267395388ada988534d848638312ccb68 for node:latest with digest node#sha256:bf60a164bc588967ce6e3342c9d6508bf9ad2e7e2a1c237315596eab3e13428b ...
Preparing environment
00:03
Running on runner-z3wu8uu--project-21153296-concurrent-0 via runner-z3wu8uu--srm-1603581774-6b7f1e48...
Getting source from Git repository
00:23
$ eval "$CI_PRE_CLONE_SCRIPT"
Fetching changes with git depth set to 50...
Initialized empty Git repository in /builds/chicagotestout/chicagotestout.gitlab.io/.git/
Created fresh repository.
Checking out b73b89bb as master...
Skipping Git submodules setup
Executing "step_script" stage of the job script
00:01
$ cd public/scripts/
$ npm i
up to date, audited 49 packages in 644ms
found 0 vulnerabilities
$ cd elm/
$ npx elm make src/Main.elm --output=index.js
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /builds/chicagotestout/chicagotestout.gitlab.io/public/scripts/elm/package.json
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, open '/builds/chicagotestout/chicagotestout.gitlab.io/public/scripts/elm/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2020-10-24T23_24_44_668Z-debug.log
Cleaning up file based variables
00:01
ERROR: Job failed: exit code 1
So it's looking for a package.json file in the elm subdirectory. Okay. But I don't have (and don't need, and don't want) a package.json file there. The relevant package.json file is in its parent directory (scripts) where elm is installed.
Confounding factors
You might be wondering what was in the commit that broke the build when it quit working, but there's nothing in that commit that should have broken the build in this way. The commit didn't touch any configuration files, just some .elm source files.
My gut says this is an npm thing, but I can't quite rule out the idea that this is an elm thing or a gitlab-ci thing.
I've searched for this issue, but it seems like this is a pretty uncommon issue, and I'm struggling to filter out a heap of other package.json search terms.
In Conclusion
How do I get npx to look in the parent directory for the appropriate package.json?
Help appreciated.

How to fix "Error: Watching remote files is not supported" problem in Visual Studio Code

I have Vue application that I don't run for a while and now I cannot start development server?! In meanwhile something updated and that don't work. I tried new clean vue/vuetify install and same problem!
Build for production works normally, only run development server don't work.
And important notice: when run "npm run serve" in command prompt (outside VS Code), it works normally. That not work only in VS Code Terminal. What is problem?
Node version is v10.16.0
Npm version is 6.10.3
VS Code About:
Commit: 036a6b1d3ac84e5ca96a17a44e63a87971f8fcc8
Date: 2019-08-08T02:33:50.993Z
Electron: 4.2.7
Chrome: 69.0.3497.128
Node.js: 10.11.0
V8: 6.9.427.31-electron.0
OS: Windows_NT x64 10.0.17763
Error (from terminal window):
> Executing task: npm run serve <
> portal#0.1.0 serve d:\Wamp64\www\portal
> vue-cli-service serve
INFO Starting development server...
10% building 2/2 modules 0 active ERROR Error: Watching remote files is not supported.
Error: Watching remote files is not supported.
at Server.setupWatchStaticFeature (d:\Wamp64\www\portal\node_modules\webpack-dev-server\lib\Server.js:405:13)
at Object.watchContentBase (d:\Wamp64\www\portal\node_modules\webpack-dev-server\lib\Server.js:477:14)
at forEach (d:\Wamp64\www\portal\node_modules\webpack-dev-server\lib\Server.js:550:24)
at Array.forEach (<anonymous>)
at Server.setupFeatures (d:\Wamp64\www\portal\node_modules\webpack-dev-server\lib\Server.js:549:49)
at new Server (d:\Wamp64\www\portal\node_modules\webpack-dev-server\lib\Server.js:125:10)
at serve (d:\Wamp64\www\portal\node_modules\#vue\cli-service\lib\commands\serve.js:139:20)
at process._tickCallback (internal/process/next_tick.js:68:7)
at Function.Module.runMain (internal/modules/cjs/loader.js:832:11)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! portal#0.1.0 serve: `vue-cli-service serve`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the portal#0.1.0 serve 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! C:\Users\Sasa Gosovic\AppData\Roaming\npm-cache\_logs\2019-08-11T10_35_40_418Z-debug.log
The terminal process terminated with exit code: 1
Press any key to close the terminal.
Exactly the same issue here. I resolved it by rolling back the version of webpack-dev-server.
npm install webpack-dev-server#3.7.2 --save-dev
Looks like the setupWatchStaticFeature function has changed between 3.7.2 and 3.8.0 which is triggering the issue.
You can eddit the vue.config.js file, adding following code:
devServer: {
contentBase: './public'
}
More details: https://github.com/webpack/webpack-dev-server/issues/2190#issuecomment-520670599
Until the issue is open, a workaround could be to use Git Bash instead of Windows command line to run npm run serve. I modified Server.js to output the contentBase variable. When using Windows command line or Vue UI, the variable contained "c:\...". Using Git Bash on my Windows 10 machine it contains "C:\..." and it worked.

GitLab private runner stuck on npm install

I'm trying to set up a CI pipeline on GitLab.com using a private runner instead of a shared one. The project uses Node, so I'm using a node:6 image.
The .gitlab-ci.yml looks like this:
image: node:6
stages:
- test
javascript_tests:
stage: test
script:
- npm install
- npm run test:unit
when: always
The runner stays on "running" stage for about 30 minutes and only then started to output something relevant:
npm ERR! fetch failed
http://10.252.156.164:4880/#types%2fjsforce/-/jsforce-1.9.2.tgz
npm WARN retry will retry, error on last attempt: Error: connect ETIMEDOUT 10.252.156.164:4880
What can I do to solve this? I thought that installing gitlab-runner on a DigitalOcean droplet would be the only things to worry about.
Replacing node:6 with node:latest fixed this problem.

Getting error on running command npm start

I am trying to run the project its given following error.
npm start error Failed at the nedben-fe#0.0.1 start script ' grunt
live'.
I tried the following but it did not work
npm i findup-sync --save