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: cannot find file .npmignore #20

Open
AndreyNikiforov opened this issue Apr 19, 2017 · 25 comments
Open

Error: cannot find file .npmignore #20

AndreyNikiforov opened this issue Apr 19, 2017 · 25 comments

Comments

@AndreyNikiforov
Copy link

Trying to use now-pipeline and get:

Something went wrong
Sometimes restarting pipeline can help
Error: cannot find file .npmignore
at lazyAssLogic (/usr/local/lib/node_modules/now-pipeline/node_modules/lazy-ass/index.js:110:14)
at lazyAss (/usr/local/lib/node_modules/now-pipeline/node_modules/lazy-ass/index.js:115:28)
at filenames.forEach.name (/usr/local/lib/node_modules/now-pipeline/src/index.js:118:9)
at Array.forEach (native)
at deploy (/usr/local/lib/node_modules/now-pipeline/src/index.js:117:17)

per now doc (https://zeit.co/docs/features/now-cli#selecting-files-and-directories-to-be-uploaded) .npmignore file is optional. Please advise.

@bahmutov
Copy link
Owner

Hmm, if that is the case, it should not throw an exception there. Care to fix this and submit a pull request? I promise to merge it quickly.

@karuppiah7890
Copy link

This looks like a important PR. Shall I contribute to it ?

@karuppiah7890
Copy link

What do you suggest we do about this ? pkgd module basically includes .npmignore too in the files. Do we ignore it in this line ?

@bahmutov
Copy link
Owner

bahmutov commented Aug 3, 2017

Hi @karuppiah7890

Thank you for looking at this. I would make a list of optional filenames with .npmignore, check list of files to deploy against it. If the file is not found and it is in the optional filenames list, skip it

@karuppiah7890
Copy link

@bahmutov Yeah, makes sense. I will look into it and see what other files are optional in now deployment.

@wulfmann
Copy link
Contributor

wulfmann commented Aug 4, 2017

I too am experiencing this issue for some reason. Is this due to an incorrect configuration on my end or is this affecting everyone?

@bahmutov
Copy link
Owner

bahmutov commented Aug 4, 2017

This is a weird issue and I do not completely understand when and why it happens. Might be because I use .gitignore file that is a sub for .npmignore?

@bahmutov
Copy link
Owner

bahmutov commented Aug 4, 2017

Can you run the tool with DEBUG=now-pipeline? This will show the files it is trying to deploy

@wulfmann
Copy link
Contributor

wulfmann commented Aug 4, 2017

From CI?

@bahmutov
Copy link
Owner

bahmutov commented Aug 4, 2017

that's where it happens? sure on CI you can either set an environment variable or just update your CI file command, something like

script:
  - npm i -g now-pipeline
  - DEBUG=now-pipeline now-pipeline

@wulfmann
Copy link
Contributor

wulfmann commented Aug 4, 2017

It happens both locally and from ci.

from debug:

+ [email protected]
added 112 packages in 5.33s
npm info ok 

�+ DEBUG=now-pipeline now-pipeline
Fri, 04 Aug 2017 16:46:01 GMT now-pipeline deploying 11 files
Fri, 04 Aug 2017 16:46:01 GMT now-pipeline [ 'package.json',
  '.npmignore',
  'bitbucket-pipelines.yml',
  'data/test.json',
  'now.json',
  'readme.md',
  'rules.json',
  'src/handlers.js',
  'src/index.js',
  'src/product.js',
  'src/index.html' ]
Something went wrong
Sometimes restarting pipeline can help
Error: cannot find file .npmignore
    at lazyAssLogic (/usr/local/lib/node_modules/now-pipeline/node_modules/lazy-ass/index.js:110:14)
    at lazyAss (/usr/local/lib/node_modules/now-pipeline/node_modules/lazy-ass/index.js:115:28)
    at filenames.forEach.name (/usr/local/lib/node_modules/now-pipeline/src/index.js:122:9)
    at Array.forEach (native)
    at deploy (/usr/local/lib/node_modules/now-pipeline/src/index.js:121:17)
    at <anonymous>

@wulfmann
Copy link
Contributor

wulfmann commented Aug 4, 2017

I don't have a .npmignore file in my repo, so is now-pipeline adding that somewhere?

I see it in the file array.

@bahmutov
Copy link
Owner

bahmutov commented Aug 4, 2017

no, this list comes from pkgd that for some reason thinks it should be part of the NPM published package. Hmm, https://github.com/inikulin/pkgd does not have any issues related to this file.

Do you want to fix this (I think it should be done like #20 (comment)) ? A pull request with the fix would be greatly appreciated.

@wulfmann
Copy link
Contributor

wulfmann commented Aug 4, 2017

Yes I will try to get a PR up within the hour.

I've traced the requirement back to here:
https://github.com/npm/fstream-npm/blob/master/fstream-npm.js#L300

It would seem that pkgd is just pulling that entire list and using that as it's requirements. I'm trying to figure out the best way to alter that.

@karuppiah7890
Copy link

@wulfmann Woah

@bahmutov
Copy link
Owner

bahmutov commented Aug 4, 2017

@wulfmann just have our own "optional" list?

@karuppiah7890
Copy link

@bahmutov That's a big question to ask. But first, we need to check what now.sh considers optional, since if we don't include that, now.sh is gonna throw errors

@karuppiah7890
Copy link

For now, we can just keep .npmignore and see what other similar files are optional for now.sh deployment and not check for them

@wulfmann
Copy link
Contributor

wulfmann commented Aug 4, 2017

Yea that should work. I have an idea on how to add an optional list, just making sure I fully understand everything that’s going on.

@wulfmann
Copy link
Contributor

wulfmann commented Aug 4, 2017

Though this is hardly a fix, adding an empty .npmignore resolves the issue.

I'm working on a fork to retool the whole file-checking section since there are a few different rules as to which file / property takes precedence.

I put the loop of 'readFileSync' of the filenames in a try catch instead and that allowed the function to continue without the presence of the .npmignore, but threw a 500 server error at the very end. I need to try it with the correct keys but I still think it's an error somewhere else.

I'll keep you guys updated but it will probably take me a few days to get to it. If you have any suggestions i'd love to hear them. This is a great module so I really want to contribute and continue using it.

@spences10
Copy link

spences10 commented Jan 8, 2018

I'm experiencing this issue as well, debug output here:

https://gist.github.com/anonymous/4a5a337b210c4ecf8084652a83385a34

Do I create a .npmignore file in Travis?

@wulfmann
Copy link
Contributor

wulfmann commented Jan 8, 2018

Apologies that I never got back to this. I've opened a PR with a simple change that should solve the issue.

@wulfmann
Copy link
Contributor

wulfmann commented Jan 8, 2018

@spences10 My changes were merged. Whenever the npm package is updated could you check and see if you are still experiencing that issue? I'm working on recreating the issue i had with it back in August to make sure it's all set, but it will likely be confirmed sooner by you.

@bahmutov
Copy link
Owner

bahmutov commented Jan 8, 2018

ok, published as 1.9.0

@spences10
Copy link

I'll get on this shortly.

I'll take out the touch .npmignore from my .travis.yml so I'm hoping that will get me past this issue, I still haven't managed to get now-pipeline to push a build I can view with now ls from my terminal.

Thanks @wulfmann 👍

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

No branches or pull requests

5 participants