Tag: yarnpkg

如何成功lockingmonorepo中的节点模块依赖关系?

我正在开发一个开源项目,目前正在使用lerna来帮助pipe理包含多个包的单个存储库。 到目前为止,这么好,除了时不时的事情打破,因为我们目前没有收缩任何东西。 我一直在试图做一些monorepo版本的shrinkwrapping,这样我们就不会受到所有依赖关系的支配(在发布的过程中,每次出错的频率都是惊人的!),但却遇到了一些困难,想知道我是否在正确的轨道上。 我最初希望能够使用我从以前的项目中熟悉的npm shrinkwrap。 不幸的是, lerna似乎不支持拆封 。 Bscheme是利用纱线,经过一些初步的困难后,切换到使用纱线工作区后似乎会好yarn install –frozen-lockfile至less我认为yarn install –frozen-lockfile正在做我想要的。 不幸的是,除了依赖locking之外,纱线似乎不能帮助所有的npm和lena工作,但是lena和纱线工作空间似乎导致了解决模块的问题(甚至是在同样的目录中解决这个问题)。 也许切换到纱线无论如何是矫枉过正,所以我开始怀疑是否更新版本的npm和package-lock.json是一个更好的主意。 不幸的是,这似乎需要一些与lerna的工作,在这一点上,我开始怀疑有多lesslerna是真的添加。 也许放弃lerna会有所帮助? 所以, tl; dr ,有没有人有一个好方法locking模块依赖关系monorepo?

NPM预安装脚本

我试图在安装任何软件包之前运行一些策略脚本。 例如: { "name": "pre-hook-check", "version": "1.0.0", "description": "", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", "preinstall": "echo preinstall", "postinstall": "echo postinstall" }, "author": "", "license": "ISC", "dependencies": { "abc": "^0.6.1", "preact": "^8.2.5" } } 上面的例子中的前后安装脚本似乎只有当我做npm install ,但我希望这每次我尝试安装任何东西时运行。 例如:假设我想编写一个脚本来检查包的版本,只要我的团队运行npm install <some package> 。 我想检查安装包的版本,并确认它的版本是在“1.0.0”以上,否则不要让它们安装。 我打算写一个预安装脚本 npm info lodash version […]

如何组织我的纱线包

我是Yarn的新手(阅读Bower已弃用),我正在寻求最佳实践来区分服务器端库和WebUI浏览器库。 我正在运行一个server.js ( node.js ),我需要为其安装库,我通常将它们留在node_modules 。 我曾经用npm安装它们 我的webapp也有静态库,我想在我的assets文件夹。 yarn add jquery yarn install –modules-folder assets/vendor 现在,将所有的NPM库安装到assets/vendor ,而我只是想在那里有jquery 。 怎么办? 纱是NPM的替代品吗?

如何以非交互方式login纱线?

当使用npm ,我可以非交互方式login: $ printf "jesstelford\n<password>\nexample@email.com\n" | npm login 但是,与yarn类似的命令挂起: $ printf "jesstelford\nexample@email.com\n" | yarn login yarn login v0.21.3 question npm username: jesstelford question npm email: 在交互模式下,我可以成功运行: $ yarn login yarn login v0.21.3 question npm username: jesstelford question npm email: example@email.com ✨ Done in 22.53s. 我怎样才能非交互式地运行yarn login ?

不明白纱线检查警告

当我运行yarn check我得到这个警告: warning "\u001b[2mchokidar#\u001b[22mfsevents#node-pre-gyp@^0.6.29" could be deduped from "0.6.32" to "node-pre-gyp@0.6.32" 请有人帮我理解这一点? 我不知道这个词是什么意思。 为什么警告信息中有太多垃圾字符? 我应该怎么做才能解决这个警告? 非常感谢!

在Visual Studio代码中用纱线运行NodeJS项目

我有一个NodeJS项目,我可以使用yarn start命令从命令行yarn start 。 我的package.json看起来类似于这个: { "name": "projectname", "version": "0.0.1", "description": "", "author": "My Name", "license": "", "scripts": { "start": "yarn dev", "dev": "yarn stop && pm2 start pm2-dev.yaml && webpack-dev-server –progress", "prod": "yarn stop && yarn build && pm2 start pm2-prod.yaml", "build": "rimraf dist lib && babel src -d lib –ignore test.js && cross-env […]

Ember.js 2.7不会使用纱线生成 – 使用npm生成

版本: ember.js 2.7,ember-data 2.7 ember-cli 2.9.1 //对于烬2.7也是如此 节点6.9.1,npm 3.10.9 //对于节点4.4.4和npm 2.15.5也是如此 Mac El Capitan 重现步骤: rm -Rf node_modules bower_components yarn bower install ember s或ember build 症状: Build failed. The Broccoli Plugin: [Funnel: Funnel vendor/ember-cli-qunit/images /assets include:2] failed with: Error: ENOENT: no such file or directory, scandir '/Users/somePath/client/tmp/funnel-input_base_path-nIg5n9K9.tmp/0/vendor/ember-cli-qunit/images/' at Error (native) at Object.fs.readdirSync (fs.js:951:18) at FSMonitor._measure […]

我应该添加yarn-error.log到我的.gitignore文件吗?

纱线已经创build了yarn.lock和yarn-error.log 。 我被告知不要将yarn.lock添加到我的.gitignore文件,因为它locking了包。 我应该忽略后者吗?

没有在gitlab ci中find纱线命令

我想configuration我的gitlab-ci使用yarn install而不是npm install 我目前的gitlab-ci.yml如下所示: image: node:6.9.4 cache: paths: – node_modules/ – .yarn before_script: – apt-get update -qq && apt-get install -qy libelf1 stages: – test test_core: stage: test script: – yarn config set cache-folder .yarn – yarn install – npm run build – npm run test tags: – 2gb 但是编译失败,错误: /bin/bash: line 48: yarn: command […]

react_on_rails安装:yarn是必需的错误

我正在尝试根据以下说明为现有的rails 5.0应用程序设置react_on_rails: https : //github.com/shakacode/react_on_rails gem“react_on_rails”,“8.0.0” rails生成react_on_rails:install 我得到以下错误: ERROR: yarn is required. Please install it before continuing. https://yarnpkg.com/en/docs/install 现在这是我的纱线npm和节点path: [user@server]$ which node /usr/bin/node [user@server]$ which npm /usr/bin/npm [user@server]$ which yarn ~/.yarn/bin/yarn 我如何确保使用合适的纱线并帮助安装react_on_rails? 编辑:这是我的〜/ .bashrc文件: export PATH="$HOME/.rbenv/bin:$PATH" eval "$(rbenv init -)" export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm [ -s […]