yarn install skips packages on Jenkins - jenkins

When run manually, yarn install works without a hitch.
When run from Jenkins, however, one package is simply missing! Even when run after a manual execution. I only run a single instance of yarn each time.
In both cases (manual and Jenkins) I use the same working directory and the same user. The missing package is ng, and it's a dependency of #angular (yarn install creates more package.json files in nested folders).
Any ideas what could be the cause of this issue?

Currently I use yarn install --check-files as a workaround until I figure out why yarn deletes packages in the first place. If anyone has a better solution I'd like to hear it :)

Related

#types/express-serve-static-core/index.d.ts causing build errors

Started encountering this issue after pushing changes which has nothing to do with the node_modules or the deployment pipeline.
This issue is also seen when trying to rerun an already successful deployment in bitbucket.
I even tried updating the some of the packages to the latest version, but it still throws the same error.
But locally in my pc I have no issue with npm run build.
When the bitbucket pipeline is run.
The docker first installs node_modules using the npm install cmd.
After this while running npm run build the pipeline is failing with the error shown in the image above.
So I suspect it is the packages in the node_modules that are newly getting downloaded, because locally I have no problem with the build cmd.
Could anyone help me out, whether it is the incompatibility between the npm packages or the pipeline itself, Or if there might be any other error.
Thank you
Thanks to #Nitheesram Rajes I was able to fix this issue by updating typescript package using the command
npm install --save-dev typescript#latest

Is there a way to install dependencies for just one package in a yarn2 monorepo?

to do a yarn immutable install for all packages it yarn 2 recommends yarn workspaces focus --production --all, is there a way to do this for just one workspace? reason being I would like to not have all dependencies for everything installed into docker containers for different applications.
Yes,
yarn workspaces focus --production (without --all flag)
installs production dependencies just for the workspace in current working directory. You can also specify the name of the workspace as an argument, e.g.:
yarn workspaces focus --production frontend

. Why I am getting an error message? Building a React App

I wanted to start practicing with React to make a simple app. Went ahead and downloaded homebrew and node onto my computer. As I build my app with yarn install I get to the end where it tells you happy hacking. But when I run yarn start it gives me an error message.
-There might be a problem with the project dependency tree.
It is likely not a bug in Create React App, but something you need to fix locally.
The react-scripts package provided by Create React App requires a dependency:
"eslint": "^6.6.0"
Don't try to install it manually: your package manager does it automatically.
However, a different version of eslint was detected higher up in the tree:
/Users/zacharyschneider/node_modules/eslint (version: 5.16.0)
Manually installing incompatible versions is known to cause hard-to-debug issues.
If you would prefer to ignore this check, add SKIP_PREFLIGHT_CHECK=true to an .env file in your project.
That will permanently disable this message but you might encounter other issues.
To fix the dependency tree, try following the steps below in the exact order:
1. Delete package-lock.json (not package.json!) and/or yarn.lock in your project folder.
2. Delete node_modules in your project folder.
3. Remove "eslint" from dependencies and/or devDependencies in the package.json file in your project folder.
4. Run npm install or yarn, depending on the package manager you use.
In most cases, this should be enough to fix the problem.
If this has not helped, there are a few other things you can try:
5. If you used npm, install yarn (http://yarnpkg.com/) and repeat the above steps with it instead.
This may help because npm has known issues with package hoisting which may get resolved in future versions.
6. Check if /Users/zacharyschneider/node_modules/eslint is outside your project directory.
For example, you might have accidentally installed something in your home folder.
7. Try running npm ls eslint in your project folder.
This will tell you which other package (apart from the expected react-scripts) installed eslint.
If nothing else helps, add SKIP_PREFLIGHT_CHECK=true to an .env file in your project.
That would permanently disable this preflight check in case you want to proceed anyway.
P.S. We know this message is long but please read the steps above :-) We hope you find them helpful!
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
zacharyschneider#Zacharys-MBP %
A way to solve this issue or help me understand what is going on that would be great or point me in the right direction to find resources.
Thanks for your Help
It seems like you have installed es-lint 5.16.0 manually, and it conflicts with the needed version (6.6.0).
Have you tried the steps suggested in the error message?
Do you explicitly tell the es-lint version in your package.json? Could you share your package.json if you continue to experience the issue?

TFS Build process hangs on any NPM command

I'm building an angular2 app, and I've developed a build profile in TFS to auto-build it.
There are four npm commands:
npm install angular-cli -g
npm install
npm run typings (executes typings install)
npm run build (executes ng build)
And then a Copy Publish Artifact step.
However, even when every step passes, it says Finishing Copy and Publish Build Artifacts, the project has been built, and the files have been moved, the actual build never finishes. I've tried breaking those npm commands into a powershell script, having them as NPM commands within TFS, and running them as CMD commands, but the same thing happens every time. Also, if I just remote into the build server and run the commands by hand, it works just fine.
Any ideas?
We've gone through the same headache recently, and I'd strongly suggest you not rely on TFS Build to restore npm packages. Even when you get that right, it takes long and doesn't deploy the node_modules you need to IIS.
Instead, use WebPack to bundle up your node_modules into a bundle.js.
Reference this in your projects/scripts folder and check it into source control.
Remove any npm install steps in your build process (it won't be required anymore since you're referencing the bundle.js now).
This will increase your quality (no future package version surprises), and speed up your deployment (no need to download npm packages on each build anymore).
It's fairly quick to get Webpack installed and you'll save yourself headaches :)

iOS Yosemite sudo npm install -g DYLD_ environment

I have a problem after I upgraded my machine to Yosemite, whenever I run sudo npm install -g ... I got an error says
/usr/bin/dyld: DYLD_ environment variables being ignored because main executable (/usr/bin/sudo) is setuid or setgid
For example was trying to install gulp using
sudo npm install -g gulp
and got the same error ! not able to find the reason behind this issue
Generally this means that an existing, globally installed package is in bad shape. Possibly permissions related, but hard to say for sure without more information about the environment.
The solution lies in fixing the broken package. One way to do so is delete and re-install it. Try sudo npm uninstall -g <pkg> where <pkg> is anything you suspect may be broken.
If you are not sure where to start, do:
npm list -g --depth=0
That will show you all of your globally installed packages. Just remove and re-install them one by one.
If any of those throw errors during the removal process, you will need to do it yourself, manually.
First, figure out where global packages are installed. Generally, this will be /usr/local on OS X, for example. To find out for sure:
npm config get prefix
Then explore that directory, especially /usr/local/bin (for example) and if you are sure a file is related to a global npm package, it's usually safe to remove it.
`sudo rm -rf <file>`
... where <file> is the actual filename you wish to delete.
You may have gotten into this mess due to overuse of sudo.
See my answer to SNAFU with npm update -g on why sudo is bad and instructions on how to fix it.

Resources