nodejs / full-icu-npm

convenience loader for 'small-icu' node builds
https://nodejs.org/api/intl.html#intl_providing_icu_data_at_runtime
Other
152 stars 31 forks source link

Install fails when using yarn workspaces #22

Closed OliverJAsh closed 3 years ago

OliverJAsh commented 6 years ago

When using yarn workspaces to install this package, I get an error. This is similar to https://github.com/unicode-org/full-icu-npm/issues/9.

$ yarn workspace server add full-icu
yarn workspace v1.3.2
yarn add v1.3.2
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
[4/4] 📃  Building fresh packages...
[1/1] ⠄ full-icu: yarn install v1.3.2
[-/1] ⠄ waiting...
[-/1] ⠄ waiting...
[-/1] ⠄ waiting...
error /Users/OliverJAsh/Development/twitter-paper/node_modules/full-icu: Command failed.
Exit code: 1
Command: node postinstall.js
Arguments:
Directory: /Users/OliverJAsh/Development/twitter-paper/node_modules/full-icu
Output:
npm install icu4c-data@59l (Node 8.1.4 and small-icu 59.1) -> icudt59l.dat
full-icu$ /Users/OliverJAsh/.nvm/versions/node/v8.1.4/bin/node /usr/local/Cellar/yarn/1.3.2/libexec/lib/cli.js install icu4c-data@59l
yarn install v1.3.2
info No lockfile found.
error `install` has been replaced with `add` to add new dependencies. Run "yarn add icu4c-data@59l" instead.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
/Users/OliverJAsh/Development/twitter-paper/node_modules/full-icu/install-spawn.js:41
        throw(Error(cmdPath + ' ' + args.join(' ') + ' --> status ' + spawned.status));
        ^

Error: /Users/OliverJAsh/.nvm/versions/node/v8.1.4/bin/node /usr/local/Cellar/yarn/1.3.2/libexec/lib/cli.js install icu4c-data@59l --> status 1
    at npmInstallNpm (/Users/OliverJAsh/Development/twitter-paper/node_modules/full-icu/install-spawn.js:41:9)
    at Object.<anonymous> (/Users/OliverJAsh/Development/twitter-paper/node_modules/full-icu/postinstall.js:68:2)
    at Module._compile (module.js:569:30)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:503:32)
    at tryModuleLoad (module.js:466:12)
    at Function.Module._load (module.js:458:3)

error Command failed.
Exit code: 1
Command: /Users/OliverJAsh/.nvm/versions/node/v8.1.4/bin/node
Arguments: /usr/local/Cellar/yarn/1.3.2/libexec/lib/cli.js add full-icu
Directory: /Users/OliverJAsh/Development/twitter-paper/src/server
Output:

info Visit https://yarnpkg.com/en/docs/cli/workspace for documentation about this command.

As a workaround, if I cd to the workspace and run:

yarn add full-icu

it works.

srl295 commented 6 years ago

I have not used workspaces. Probably needs a different way to detect yarn.

Swatinem commented 5 years ago
Exit code: 1
Command: node postinstall.js
Arguments:
Directory: …/node_modules/full-icu
Output:
npm install icu4c-data@62l (Node 10.15.3 and small-icu 62.1) -> icudt62l.dat
Looks like you are using yarn…
full-icu$ …/node …/node_modules/yarn/bin/yarn.js add icu4c-data@62l --no-lockfile --ignore-scripts
yarn add v1.16.0
error An unexpected error occurred: "Cannot read property 'manifest' of undefined".
info If you think this is a bug, please open a bug report with the information provided in "…/node_modules/full-icu/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
…/node_modules/full-icu/install-spawn.js:41
        throw(Error(cmdPath + ' ' + args.join(' ') + ' --> status ' + spawned.status));
        ^

With workspaces, the monorepo only has a single lockfile, not sure if that is the problem though? But the problem seems yarn related…

Andret2344 commented 4 years ago

Still having the same issue on yarn add -D full-icu:

error <FULL_PATH>\node_modules\full-icu: Command failed.
Exit code: 1
Command: node postinstall.js
Arguments:
Directory: C:\Users\Andret\PhpstormProjects\mfpkis\node_modules\full-icu
Output:
npm install icu4c-data@67l (Node 12.18.0 and small-icu 67.1) -> icudt67l.dat
Looks like you are using yarn…
full-icu$ C:\Program Files\nodejs\node.exe C:\Program Files (x86)\Yarn\bin\yarn.js add icu4c-data@67l --no-lockfile --ignore-scripts
yarn add v1.22.4
info No lockfile found.
[1/4] Resolving packages...
info There appears to be trouble with the npm registry (returned undefined). Retrying...
info There appears to be trouble with the npm registry (returned undefined). Retrying...
info There appears to be trouble with the npm registry (returned undefined). Retrying...
info There appears to be trouble with the npm registry (returned undefined). Retrying...
C:\Program Files (x86)\Yarn\lib\cli.js:66073
            throw new (_errors || _load_errors()).ResponseError(_this3.reporter.lang('requestFailed', description), res.statusCode);
            ^

ResponseError: Request failed "503 Service Unavailable"
    at ResponseError.ExtendableBuiltin (C:\Program Files (x86)\Yarn\lib\cli.js:696:66)
    at new ResponseError (C:\Program Files (x86)\Yarn\lib\cli.js:802:124)
    at Request.params.callback [as _callback] (C:\Program Files (x86)\Yarn\lib\cli.js:66073:19)
    at Request.self.callback (C:\Program Files (x86)\Yarn\lib\cli.js:140748:22)
    at Request.emit (events.js:315:20)
    at Request.<anonymous> (C:\Program Files (x86)\Yarn\lib\cli.js:141720:10)
    at Request.emit (events.js:315:20)
    at IncomingMessage.<anonymous> (C:\Program Files (x86)\Yarn\lib\cli.js:141642:12)
    at Object.onceWrapper (events.js:421:28)
    at IncomingMessage.emit (events.js:327:22) {
  responseCode: 503
}
C:\Users\Andret\PhpstormProjects\mfpkis\node_modules\full-icu\install-spawn.js:62
                throw(Error(cmdPath + ' ' + args.join(' ') + ' --> status ' + spawned.status));
                ^

Error: C:\Program Files\nodejs\node.exe C:\Program Files (x86)\Yarn\bin\yarn.js add icu4c-data@67l --no-lockfile --ignore-scripts --> status 1
    at npmInstallNpm (C:\Users\Andret\PhpstormProjects\mfpkis\node_modules\full-icu\install-spawn.js:62:9)
    at Object.<anonymous> (C:\Users\Andret\PhpstormProjects\mfpkis\node_modules\full-icu\postinstall.js:72:2)
    at Module._compile (internal/modules/cjs/loader.js:1138:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
    at Module.load (internal/modules/cjs/loader.js:986:32)
DavideDaniel commented 4 years ago

yarn 2 and workspaces is a completely different world in some ways. For example, the node_modules folder is largely gone.. only necessary for certain packages that are not yet converted to work with yarn 2 world.. most notably, from my understanding full-icu is relying on postinstall and yarn 2 has issues with it (https://yarnpkg.com/advanced/lifecycle-scripts#a-note-about-postinstall). We are probably going to stop using full-icu unfortunately.. I've been mulling it over about how to leverage it without having to choose between the 2. My current thought was to use full-icu in the environment but not as part of my package.json install probably. It could be in a parent package outside the workspace maybe.. tbd...

srl295 commented 3 years ago

fixed by https://github.com/nodejs/full-icu-npm/issues/38 no longer trying to do a sub install