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

fix for npm >= 5.3.0, changed tempDir location to os.tmpDir() #19

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

reg0
Copy link

@reg0 reg0 commented Jun 12, 2018

error when running npm-bundle with npm >= 5.3.0:

D:\Profiles\<PROFILE>\AppData\Roaming\npm\node_modules\npm-bundle\bin\cli.js:11
    throw error
    ^

Error: ENOENT: no such file or directory, open 'D:\<PATH>\.npmbundle\node_modules\<PROJECT>\package.json'

underlying reason of the problem: https://stackoverflow.com/questions/45555682/npm-install-local-package-creates-symbolik-link

turns out, that instead of copying the whole project contents when doing npm i <folder>, npm creates symbolic link, after that rimraf was being called to remove .npmbundle from nested node_modules; unfortunately, since it was a symlink, it also removed original tempdir contents and couldn't find original package.json and hence the error

what I did to fix it was just changing location of tempDir to os.tmpDir() instead of putting it within the project directory, that does the trick (at least works for me on Windows)
unfortunately, the fix is not 100% good, because it still operates on a symlink and due to that, after running npm-bundle, I end up with modified package.json in my project, with bundledDependencies appended

@KeshiaRose
Copy link

THANK YOU! This worked for me.

@markl-vesper
Copy link

npm 6.9.0
nvm 1.1.7
node 12.0.0
npm-bundle 3.0.3

running npm-bundle from my project root dir that contains package.json give me error

C:\Users\MarkLL~1\AppData\Roaming\nvm\v12.0.0\node_modules\npm-bundle\bin\cli.js:11``
throw error
^

Error: ENOENT: no such file or directory, open 'C:\Development\cortex-monitoring.npmbundle\node_modules\cortexmonitor\package.json'

I have tried the fix but still same error.

@scaralfred
Copy link

Me too, same error even with that fix

Copy link

@GaryDelancy GaryDelancy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes fixed my issue. Windows/VS Code.

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 this pull request may close these issues.

5 participants