Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error running deploy command in 11.10.0 - "Error: Cannot find module 'is-npm'" #5010

Closed
stewart42 opened this issue Sep 23, 2022 · 19 comments · Fixed by #5019
Closed

Error running deploy command in 11.10.0 - "Error: Cannot find module 'is-npm'" #5010

stewart42 opened this issue Sep 23, 2022 · 19 comments · Fixed by #5019

Comments

@stewart42
Copy link

Environment info

firebase-tools:

➜ npx firebase-tools --version
Downloading Chromium r869685 - 112.4 Mb [====================] 100% 0.0s 
11.10.0
Cannot find module 'is-npm'
Require stack:
- /Users/stewart/.npm/_npx/45995/lib/node_modules/firebase-tools/node_modules/update-notifier/index.js
- /Users/stewart/.npm/_npx/45995/lib/node_modules/firebase-tools/lib/bin/firebase.js

Platform:

macOS (m1)

Test case

Using version 11.10 to do a hosting:channel:deploy does succeed in deploying, however it fails to exit successfully as a error is thrown Cannot find module 'is-npm'

Steps to reproduce

run npx firebase-tools hosting:channel:deploy pr414-blah --only special-deploy --expires 14d --project test-project --debug

Expected behavior

The deploy succeeds and exits successfully with no errors.

Actual behavior

❯ npx firebase-tools hosting:channel:deploy pr414-blah --only special-deploy --expires 14d --project test-project  --debug
Downloading Chromium r869685 - 112.4 Mb [====================] 100% 0.0s 
[2022-09-23T08:52:38.718Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[2022-09-23T08:52:38.719Z] > authorizing via signed-in user (***@***.com)
[2022-09-23T08:52:38.719Z] [iam] checking project test-project for permissions ["firebase.projects.get","firebasehosting.sites.update"]
[2022-09-23T08:52:38.721Z] > refreshing access token with scopes: []
...
✔  hosting:channel: Channel URL (***): https://***.web.app [expires 2022-10-07 10:52:45] 
[2022-09-23T08:53:10.615Z] Error: Cannot find module 'is-npm'
Require stack:
- /Users/stewart/.npm/_npx/46162/lib/node_modules/firebase-tools/node_modules/update-notifier/index.js
- /Users/stewart/.npm/_npx/46162/lib/node_modules/firebase-tools/lib/bin/firebase.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
    at Function.Module._load (internal/modules/cjs/loader.js:746:27)
    at Module.require (internal/modules/cjs/loader.js:974:19)
    at require (internal/modules/cjs/helpers.js:101:18)
    at lazy (/Users/stewart/.npm/_npx/46162/lib/node_modules/firebase-tools/node_modules/import-lazy/index.js:2:51)
    at /Users/stewart/.npm/_npx/46162/lib/node_modules/firebase-tools/node_modules/import-lazy/index.js:10:11
    at UpdateNotifier.notify (/Users/stewart/.npm/_npx/46162/lib/node_modules/firebase-tools/node_modules/update-notifier/index.js:117:59)
    at process.<anonymous> (/Users/stewart/.npm/_npx/46162/lib/node_modules/firebase-tools/lib/bin/firebase.js:108:20)
    at process.emit (events.js:412:35)
    at process.exit (internal/process/per_thread.js:179:15)
    at /Users/stewart/.npm/_npx/46162/lib/node_modules/firebase-tools/lib/command.js:105:25
    at processTicksAndRejections (internal/process/task_queues.js:95:5)

Error: An unexpected error has occurred.

Note that even --version triggers the error (see at the top of this issue)

@matvi3nko
Copy link

I can confirm. We also faced this issue even with no code changes in our projects. Currently we cannot deploy them.

@aliak00
Copy link

aliak00 commented Sep 23, 2022

Also confirmed - We were on version 10.7.0 and it's happening.

@ratrock
Copy link

ratrock commented Sep 23, 2022

This is happening to us, too, using FirebaseExtended/action-hosting-deploy@v0 Github action. We deployed successfully yesterday, but not today.

@jmarbutt
Copy link

This is happening to us also.

@bkendall
Copy link
Contributor

That is... very odd. I see it in npm ls, so it should be there but obviously...

Can one of y'all who can replicate it locally tell me what version of node and npm you are using?

@DerekLinHF
Copy link

this is also happening to us as well

@bkendall
Copy link
Contributor

Ah, I'm getting more of the sense that it's GH action specific. Let me see if I can figure out what's going on there.

@yuleidyvdres
Copy link

Same here

1 similar comment
@dayoherrera
Copy link

Same here

@JavierB7
Copy link

It's happening to us also.

@odinho
Copy link

odinho commented Sep 23, 2022

I suggest stopping with all the "me too"'s. It's likely affecting a huge number of projects. Put a thumbs-up emoji on the top post.

If you're using Firebase hosting and not getting this, a comment might make sense. It sounds like this currently affects everyone using this.

@amithvns
Copy link

amithvns commented Sep 23, 2022

We are using Firebase hosting for different repo's github actions and some are working and some are failing.
At a quick glance looks like it is failing for actions where its set to use nodejs version 14.x and the actions are successful where we are not setting to use nodejs 14.x

@theonetheycallneo
Copy link

theonetheycallneo commented Sep 23, 2022

Yes we also get an error going 1 version back as well, yarn add -D [email protected]
Appears some of the sub-deps need patch-package as a global dep

npm install -g patch-package
error /Users/neo/Projects/vatom-inc/wallet/node_modules/jsdoc/node_modules/underscore: Command failed.
Exit code: 127
Command: patch-package
Arguments:

@aliak00
Copy link

aliak00 commented Sep 24, 2022

Confirmed @amithvns's at-a-glance! Changed my github actions to use node 16 and it's working.

image

@jmarbutt
Copy link

Our (@amithvns also ) app has some older dependencies that currently don't work with node v16.x so we solved this by swapping the version before our build and then swapping back to 16x.

Here are our build steps

    steps:
      - uses: actions/checkout@v2
      - name: Setup node 14
        uses: actions/setup-node@v1
        with:
          node-version: 14.x
      - run: node -v && npm ci && npm run build
      - name: Setup node 16
        uses: actions/setup-node@v1
        with:
          node-version: 16.x

@jmarbutt
Copy link

I guess my real question is why did this really break? Because if you are specifying a version like FirebaseExtended/action-hosting-deploy@v0, shouldn't it not have breaking changes unless we bump the version?

@matvi3nko
Copy link

We also use FirebaseExtended/action-hosting-deploy@v0 and have this error Error: Cannot find module 'is-npm’ even npm I -D is-npm doesn’t help. Thanks

@theonetheycallneo
Copy link

What we did for now is switch to rolling back the version:

yarn global add patch-package [email protected]

then remove this action and do it manually:

echo $(firebase hosting:channel:deploy {FIREBASE_PROJECT_ID} --expires 7d --debug --json)
            read appUrl storybookUrl < <(echo $(firebase hosting:channel:deploy {FIREBASE_PROJECT_ID} --expires 7d --debug --json | jq -r '.result.app.url, .result.storybook.url'))

            echo $appUrl 
            echo $storybookUrl

            pr_response=$(curl --location --request GET "https://api.github.com/repos/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/pulls?head=$CIRCLE_PROJECT_USERNAME:$CIRCLE_BRANCH&state=open" \
            -u $PR_BOT_USER:$PR_BOT_TOKEN)

            if [ $(echo $pr_response | jq length) -eq 0 ]; then
              echo "No PR found to update"
            else
              pr_comment_url=$(echo $pr_response | jq -r ".[]._links.comments.href")
            fi

            body=":rocket: Visit the preview URL for this PR (updated for commit $CIRCLE_SHA1): \n- $appUrl\n- $storybookUrl"

            curl --location --request POST "$pr_comment_url" \
            -u $PR_BOT_USER:$PR_BOT_TOKEN \
            --header 'Content-Type: application/json' \
            --data-raw "{ \"body\": \"$body\" }"

One Suggestion:

  • We should have an optional "version" parameter to specify the firebase-tools@{version} for this action.

bkendall pushed a commit that referenced this issue Sep 26, 2022
* Fail gracefully with update-notifier. Fixes #5010.

* Add changelog.
@bkendall
Copy link
Contributor

For folks watching: we're going to release this tomorrow morning

christhompsongoogle pushed a commit that referenced this issue Sep 30, 2022
* Fail gracefully with update-notifier. Fixes #5010.

* Add changelog.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.