yarnpkg

Sharing code between React Native + Node

落爺英雄遲暮 提交于 2021-02-19 02:27:22
问题 I am using React Native and Node.js. I want to share code between the two. My folder structure is as so. myreactnativeapp/ mynodeserver/ myshared/ In the react native and node apps I have included the package.json "dpendencies" : { "myshared": "git+https://myrepository/ugoshared.git" } This can then be included in each project via require/import etc. This all works fine and for production I'm happy with it. (Though I'd love to know a better way?) The issue I'm facing is in development it's

Sharing code between React Native + Node

我的未来我决定 提交于 2021-02-19 02:27:12
问题 I am using React Native and Node.js. I want to share code between the two. My folder structure is as so. myreactnativeapp/ mynodeserver/ myshared/ In the react native and node apps I have included the package.json "dpendencies" : { "myshared": "git+https://myrepository/ugoshared.git" } This can then be included in each project via require/import etc. This all works fine and for production I'm happy with it. (Though I'd love to know a better way?) The issue I'm facing is in development it's

The 'npx create-react-app command' doesn't correctly work

为君一笑 提交于 2021-02-11 13:53:33
问题 As we know, there are a lot of questions in this community about npx create-react-app , but none of them couldn't solve my problem. I had used npx create-react-app several times and I didn't have any problem with it, but from a couple of days ago when I run this command, my project is created but in its folder, there isn't any files and folders that I expected to exist in it (except node_modules, package.json, and yarn.lock). For solving my problem, I updated Node.js and uninstall and

yarn install consumes all memory on TeamCity and Jenkins

偶尔善良 提交于 2021-02-11 12:29:21
问题 I'd really like to get yarn working with TeamCity or Jenkins, however yarn install consumes all my build server's cpu & memory, even with a tiny npm project. Any idea why? Summary yarn install , when run by TeamCity or Jenkins, consumes most CPU/memory, never finishes running yarn install from the command line on the build server works (finishes in a few seconds) npm install completes in a few seconds when run by TeamCity/Jenkins build server: Windows Server 2012, 2 cores, 4GB mem yarn

Install yarn global on Docker file

旧时模样 提交于 2021-02-11 12:23:24
问题 I'm trying to get a global package recognized by yarn and the docker image. FROM ruby:2.7.2 RUN apt-get update -qq && apt-get install -y nodejs libvips-tools yarn # Install all gems first. # This hits the warm cache if unchanged so bundling is faster. COPY Gemfile* /tmp/ WORKDIR /tmp RUN bundle install WORKDIR /sapco COPY . /sapco # Get yarn and install global required packages RUN yarn global add mjml EXPOSE 3000 # Start the main process. CMD ["rails", "server", "-b", "0.0.0.0"] I build this

Yarn Berry - Run a Node Script Directly

☆樱花仙子☆ 提交于 2021-02-11 12:01:28
问题 Yarn berry (v2) got rid of node_modules (which I really love) by introducing pnp. However, scripts executed by node directly don't understand pnp modules, so you have to use yarn to run such a script. Is there some way (e.g. a require script like ts-node provides) so that I can still use node to launch my script that requires pnp modules? Background is that I want to configure the Mocha Sidebar extension for VS Code to support pnp. I can add configure node options there and specify files that

Error “error Couldn't find package ”XXX" when building project on CI pipeline and when trying to add packages via Yarn

☆樱花仙子☆ 提交于 2021-02-07 06:47:08
问题 After returning to our project after the weekend my team was met with the error " error Couldn't find package "3d-view@^2.0.0" required by "gl-plot3d@^2.4.2" on the "npm" registry. " on our CI pipeline during the install phase. Additionally, this error occurred when trying to add packages with yarn, terminating the process. This error is happening on the front-end side of our project and doesn't show up upon starting it normally via yarn start. On the last push before the weekend everything

Specify which shell Yarn uses for running scripts

折月煮酒 提交于 2021-02-07 06:13:48
问题 My package.json has a script in it like this: "buildTslint": "node_modules/typescript/bin/tsc node_modules/awesomeLibrary_node_tslint/{,helpers/}*.ts", Note the {,helpers/}*.ts part, this is called Brace Expansion and is only possible in bash , not sh . When running yarn buildTslint I get the following output: # yarn buildTslint yarn buildTslint v0.22.0 $ node_modules/typescript/bin/tsc node_modules/awesomeLibrary_node_tslint/{,helpers/}*.ts error TS6053: File 'node_modules/awesomeLibrary

Force yarn install instead of npm install for Node module?

流过昼夜 提交于 2021-02-06 15:13:28
问题 I want to force using yarn install instead of npm install . I want to raise error in npm install . What should I do in package.json ? 回答1: UPDATE: Alexander's answer is the better solution and uses the same technique I describe here. I am leaving my answer in tact for posterity. The original point of my answer was to show that you can execute a small node script which should work on all platforms. In your preinstall script you can run a mini node script which should work on all platforms,

Is there a way to get the name of the npm script passed to the command specified by that script?

半腔热情 提交于 2021-02-05 09:14:07
问题 With npm or yarn, is it possible for the script specified by an npm script to know the name of the npm script itself? For example: "scripts": { "foo": "echo Original command: $0", "bar": "echo Original command: $0" } I'd like the result of those two scripts to be something like: Original command: yarn run foo Original command: yarn run bar But all I actually get is: Original command: /bin/sh . And in case it makes a difference, it's just the name of the script I need, not the yarn run part,