-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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 module './options' (fresh start) #2423
Comments
Hey @mikeerickson! 🙂 I have tried to reproduce this with the current npm version and failed. 😑 I’m wondering if you see anything any differences between my scenario and yours, and maybe that would point us what could be wrong here. 🤓 |
@gurdiga Hey there... I will perform the exact same tasks here to see what happens. I know I have done this before reporting, but I will start a new project again and record as you have done so we can compare. Thx for taking the time to do this, something is surely interfering? mse |
@gurdiga of course, when I follow this approach from scratch, all works. I will see if I can track down the issue in my current project. This for efforts, will close for now but if I can reproduce, I will reopen this ticket. |
I also encountered that issue several times without understand the origin of the problem. By the way, I deleteed the |
@damienromito I have experienced this issue soooooo many times with Mocha 3.x, it is just routine to perform
Anytime it occurs... I have had success skipping the uninstall action and just reinstall Mocha, but that has not helped 100% of the time. So I just run
and then move on as it fixes it for the time being |
If anyone can figure out what triggers the |
@ScottFreeCode I have spent quite some time trying to track it down with zero success. I have had it happen quite often, but haven't been able to find the root cause. Certainly happens frequently enough to warrant an alias reinstall when it occurs :-( |
I have a repo sync'd via dropbox on two computers (because.. well.. don't ask). The new sync gets this error while the old sync does not. If I run |
I had done a npm install on a new project and ran into this issue when doing npm test. Suggested workaround of removing node_modules directory and doing npm install again worked for me. |
@jervisfm I receive this issue randomly (never taken the to really debug it much). However, it happens frequently enough that I created an alias alias fix-mocha="npm uni -D mocha && npm i -D mocha" I just run this whenever I see the error message |
I regularly experience this when I copy and paste a Pretty bad design imho. |
Can we get done data here so we can track it down? Node version, npm version, mocha version, operating system @nathanpeck since you seem to have a consistent reproduction, could you create a test case or help us out with some more details? |
I believe this may be due to spaces on the path. I can run mocha by running |
@Munter FWIW, I have not seen this happen in quite some time. So many variables have changed since then, hard to say what the "real" cause has been. |
@Munter If I am able to reproduce, I will let you know. I am doing a lot of testing at the moment on a current project, thus I would expect at some point for this to happen again. |
Oh, I should have mentioned that. I'm using mocha 3.2.0 and node 6.7.0. |
I encountered this issue when I was running I fixed the issue by running I'm not too familiar with the internals of mocha, but one potential fix would be to move the code in The above fix would duplicate the code in |
I think I had the same issue, related to @sierranevadan 's, excepting that I Rsync'd my whole app structure to a VM guest. Regardless, I encountered this issue, nuked my local node_modules/ and ran mocha 3.2.0, node v6.10.1, yarn 0.21.3 |
The issue with Symlinks is definitely causing the issue updated the detailed here. |
Where this is caused by the symlinks having been transformed into regular files (the only confirmed cause so far that I'm aware of), it would just error on the next relative import -- it's not actually the I've had the chance to confirm that this issue can result from using So far I haven't come up with anything I think is a good idea. I've thought of a fairly wide variety of bad ones. Potential solutions vary in robustness, in helpfulness and in the assumptions they make about the package manager that's installing Mocha; I haven't come up with any that are more than marginally helpful, are robust and don't make any assumptions. One thing that has crossed my mind is that this potentially affects any (especially locally installed) CLI Node program (excepting Windows-only ones, if there even are any of those). Mocha might get hit by it more than others due to greater popularity, but to really resolve the issue in general you'd have to either have every Node CLI program handle this in some way or else change NPM's use of symlinks. So I wonder: is there some expected convention that other programs follow and Mocha just happens to be out of the ordinary for missing it? Or is this something that arguably ought to be fixed in NPM instead of every CLI program having to come up with a way to handle it? |
I have even stranger behaviour. I have a project where I use "scripts": {
"test": "MODE=test mocha -r ts-node/register test/**/*.ts --timeout 10000"
}, This works absolutely fine. Then I started working on a new project where I have exactly the same setup but kept getting this error to do with missing I changed the test script of the complaining project to explicitly point to mocha in "scripts": {
"test": "MODE=test node_modules/.bin/mocha -r ts-node/register test/**/*.ts --timeout 10000"
}, Then I noticed that the mocha install directory "scripts": {
"test": "MODE=test node_modules/mocha/bin/mocha -r ts-node/register test/**/*.ts --timeout 10000"
}, This makes the error go away. But I am not sure why the first project still works without any |
@schatekar NPM creates |
@ScottFreeCode I should have been more careful while describing what I did. I did not literally copy the folder from the working project to the new project. I looked at the |
After I wrote the above comment, I thought maybe I should go back and check the symlinks. Symlinks where not there (may be an npm bug??). I manually created the symlinks and it all works fine. |
👍 Glad you got it figure out! Only other things I'd add are:
In any case it sounds like you're good to go for now! |
Trying to create a simple test app from scratch. When executing from CLI, receive this error. If I downgrade to 2.5.3 then all is fine. Trying either of the commands below, error.
The text was updated successfully, but these errors were encountered: