question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

nodejs10 runtime doesn't work with .yarnrc yarn-path

See original GitHub issue

I have no idea where I can write bugs for newer nodejs10 runtime

At nodejs8 runtime we used yarn feature yarn-path in .yarnrc it allows us to use more modern yarn vs google runtime has. (see https://yarnpkg.com/lang/en/docs/yarnrc/)

But with nodejs10 runtime this feature doesn’t work, on deployment we have error like

Cannot find module '/workspace/bin/yarn-1.13.0/yarn.js'

I created a sample project to reproduce https://github.com/istarkov/nodejs10-runtime-error

if you run there

# uses nodejs8 runtime
yarn deploy:8

project will be deployed, result at https://europe-west1-realadvisor-v1-sites.cloudfunctions.net/test-env will show that used yarn version was 1.13.0

But if you run

# uses nodejs10 runtime
yarn deploy

the result will be

(gcloud.beta.functions.deploy) OperationError: code=3, message=Build failed: {"error": {"canonicalCode": "INVALID_ARGUMENT", "errorMessage": "`npm_install` had stderr output:\ninternal/modules/cjs/loader.js:584\n    throw err;\n    ^\n\nError: Cannot find module '/workspace/bin/yarn-1.13.0/yarn.js'\n    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)\n    at Function.Module._load (internal/modules/cjs/loader.js:508:25)\n    at Function.Module.runMain (internal/modules/cjs/loader.js:754:12)\n    at startup (internal/bootstrap/node.js:283:19)\n    at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)\nnpm ERR! code ELIFECYCLE\nnpm ERR! errno 1\nnpm ERR! test-env@1.0.0 postinstall: `yarn --version > ./version.txt`\nnpm ERR! Exit status 1\nnpm ERR! \nnpm ERR! Failed at the test-env@1.0.0 postinstall script.\nnpm ERR! This is probably not a problem with npm. There is likely additional logging output above.\nnpm WARN Local package.json exists, but node_modules missing, did you mean to install?\n\nnpm ERR! A complete log of this run can be found in:\nnpm ERR!     /builder/home/.npm/_logs/2019-04-16T17_52_23_870Z-debug.log\nnpm ERR! code ELIFECYCLE\nnpm ERR! errno 1\nnpm ERR! @ preinstall: `npm --prefix functions install`\nnpm ERR! Exit status 1\nnpm ERR! \nnpm ERR! Failed at the @ preinstall script.\nnpm ERR! This is probably not a problem with npm. There is likely additional logging output above.\n\nnpm ERR! A complete log of this run can be found in:\nnpm ERR!     /builder/home/.npm/_logs/2019-04-16T17_52_23_911Z-debug.log\n\nerror: `npm_install` returned code: 1", "errorType": "InternalError", "errorId": "8C17AC34"}}
error Command failed with exit code 1.

Please help, at least give me a direction where I can report gcloud issues and bugs, as its not the only issue I know.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:15 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
holvonixAdvaycommented, Aug 1, 2019

Is the ability to use yarn with yarn.lock file in Node 10 engine deployed to Cloud Functions on GCP? Still looks like it is using npm and not yarn when we switch to node 10 (as opposed to node 8).

0reactions
koistyacommented, Jul 29, 2020

Does anyone know why it doesn’t work with Yarn v2?

.yarn/releases/yarn-2.1.1.cjs
.yarnrc.yaml
yarnPath: .yarn/releases/yarn-2.1.1.cjs
OperationError: code=3, message=Build failed: Build error details not available.; Error ID: 98e389b6
Read more comments on GitHub >

github_iconTop Results From Across the Web

Yarn 2 with yarn-path is not working with nodejs16 runtime
yarnrc contains the path to the executable of yarn 2, like this yarn-path ".yarn/releases/yarn-2.4.0.cjs" (see https://classic.yarnpkg.com/en/ ...
Read more >
Migration | Yarn - Package Manager
A step-by-step and in-depth migration guide from Yarn 1 (Classic) to Yarn 2 (Berry).
Read more >
Yarn 2 — the future of package managers for JavaScript? - Snyk
js needs Yarn. Now that there's no node_modules directory anymore, running a one-off script such as node script.js won't work ...
Read more >
How to Install Yarn NPM Package Manager on Oracle Linux 8
bin:$PATH" > Successfully installed Yarn 1.22.18! Please open another terminal where the `yarn` command will now be available. Next, activate ...
Read more >
Using modern Yarn for deployment with Node.js on Azure App ...
Next, run yarn init -2 . You should now see 5 files and a directory get created: yarn.lock .editorconfig .yarnrc.yml ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found