-
Notifications
You must be signed in to change notification settings - Fork 328
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
Not able to run npm run test on fresh Windows install #1188
Comments
Could you see if you can repro the issue on Node v10? Also, how did you install Node? |
I am able to reproduce the error with the 12.13.0 LTS 64 bits version. The installation has been executed using the MSI package. I tried it out with the 64 version located under https://nodejs.org/dist/latest-v10.x/ and got these results. Error: Cannot find module 'C:\Users\PatrickLamber\Documents\GitHub\office365-cli\node' |
Could it be something in the npm-shrinkwrap.json file? Patrick @plamber, can you try
Note: This will create package-lock.json file that must be deleted if we find out the issue is with npm-shrinkwrap.json file and fix it. |
Hi, By following @VelinGeorgiev steps, I started receiving hundrets of errors when building the project.
When putting the npm-shrinkwrap.json back as before... everything except npm run test was working again. |
Hi,
br, |
Could you try using Node v10 and see if you can repro the issue? |
Tried it with Node v10 and I am able to reproduce the error. I also tried to create a local account to see if it might be somehow related to my Azure AD joined account. Meanwhile, I even tried the radical approach. I reset my PC and focused on installing only the necessary components. Same error. |
Thanks for confirming @plamber. @VelinGeorgiev, you're on Windows right? Can you reproduce this issue? |
I will try on fresh VM and let you know. |
Hey @VelinGeorgiev, any updates? |
I've been able to replicate the same issue on Windows 10 Pro 1903 (19008.1000) & Node LTS 12.13.1, following the same 'Minimal Path to Awesome' as Patrick. As the issue is relating to running the tests, it would appear that based on the error stack below, that
After a little bit of digging, I found this closed issue istanbuljs/nyc#1205 which suggests using a beta version of nyc 15 instead to fix the issue. I have tried the above fix and can confirm that this does resolve the issue, but that it does also result in a test failure |
Hi, Hope this helps |
@plamber @garrytrinder is this issue specific to Node v12? |
Will try repro to tomorrow. |
I’ve not had chance to test with another version but the closed issue refers to it only being an issue with Node v12.11.0 and higher. |
Got it. Shall we then rename this issue to make it clear that it's specific to Node v12 and then we can use it to track the work towards supporting it? Regarding Istanbul, I've been delaying its upgrade, because each time I did it, the coverage report got empty. After trying out some fixes, I got it to show something, but not the 100% we have, which is odd, given it's the same code. With that said, Node v12 is LTS so we should definitely start looking into ways of supporting it. Also, the version of Istanbul that we're using is quite old so it would be good to upgrade to the latest too. |
Agree on renaming the issue 👍🏻 We first need to confirm the working Node version and go from there, once we know what that version is it will help us get a clearer plan of attack. I’ll take a look confirming this later this evening. |
I have downgraded to Node 12.10.0 and can confirm that tests do run without upgrading nyc to the 15.0.0-beta.0 version, however an error is still thrown after the test results table is shown. Debug log below
|
Oddly, downgrading further to Node 10.17.0, the last LTS build for Node v10, the tests don't run at all. Debug log below
|
@plamber do you still have access to your old machine? If so, would it be possible to find out what version of node was installed on it? |
Hi, br, |
Found another closed issue which is a potential fix Looks like the issue lies with npm 6.11 and not node, I’ll take a look at testing the fix later this afternoon. |
@plamber , @garrytrinder , @waldekmastykarz I was able to repro with
Possible solutions:
The unit test fails because, I ASSUME there has been update in Node 12 This is the actual error coming from
We have just |
So it fails because of a single test? If that's the case, couldn't we adjust that one test rather than go down the route of fixing dependencies? |
@waldekmastykarz, it fails because of The test is a side effect after the upgrade. |
After upgrading nyc, have you had a look at the coverage report? It was showing empty for me in v14 and I wonder if it's still an issue with v15. |
According to this istanbuljs/nyc#1205 v14 will not solve the issue, it is |
Have you checked the coverage report produced by v15 @VelinGeorgiev? |
Yes, I did. One test is failing. We will have to fix it. |
But the coverage itself is still 100%? |
I will try to do the test fix next week and let you know if all is good. |
Hi, i cloned the repo on a fresh windows 10 install (1909) and installed node 12.13.1. I got the same error as @plamber. I removed nyc, and installed 15.0.0-beta.0, which solved the original problem. However three tests (spfx project externalize, spfx project externalize, spfx project externalize) fails. |
@eiriksanderfjeld thanks for reporting that! I will try to apply a fix and fix tests until the end of the week. |
As we have just released v2.5 of the CLI this should no longer be an issue, as we have replaced istanbuljs (nyc) with c8 as our test coverage tool in this release. @eiriksanderfjeld @plamber can you confirm that the issue no longer remains when using the latest version of the CLI on a clean Windows install? Please note that you will now require node v12 from v2.5 onwards, we will be updating our documentation to reflect this dependency under issue #1312. |
I was able to successfully test the project with the latest release. Just some notes. after running npm install, my npm-shrinkwrap.json has been changed These tests fail
spfx project externalize - covers all text report branches
|
Good to hear you're unblocked @plamber 👍
This happens occasionally. The best is to ignore npmshrinkwrap changes when committing your changes. As for the failing test, that's something we need to investigate. It shouldn't be the case. |
@plamber is this still an issue? |
@waldekmastykarz: works meanwhile.Closing the issue |
Hi,
I made a fresh Windows 10 install and tried to continue on my contributions for the Office 365 CLI. I followed these instructions step-by-step.
I am able to build and run a linked Office 365 CLI without issues. I took the latest dev branch as basis. Unfortunately, when I try to run npm run test, I receive following output:
internal/modules/cjs/loader.js:797
throw err;
^
Error: Cannot find module 'C:\Users\PatrickLamber\Documents\GitHub\office365-cli\node'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:794:15)
at Function.Module._load (internal/modules/cjs/loader.js:687:27)
at Function.Module.runMain (internal/modules/cjs/loader.js:1025:10)
at internal/main/run_main_module.js:17:11 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
----------|----------|----------|----------|----------|-------------------|
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s |
----------|----------|----------|----------|----------|-------------------|
All files | 0 | 0 | 0 | 0 | |
----------|----------|----------|----------|----------|-------------------|
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @pnp/[email protected] test:
nyc -r=lcov -r=text mocha "dist/**/*.spec.js"
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @pnp/[email protected] test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\PatrickLamber\AppData\Roaming\npm-cache_logs\2019-11-11T17_25_53_648Z-debug.log
The log is outputting this information:
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli 'C:\Program Files\nodejs\node.exe',
1 verbose cli 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'test'
1 verbose cli ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'pretest', 'test', 'posttest' ]
5 info lifecycle @pnp/[email protected]
pretest: @pnp/[email protected]test: @pnp/[email protected]6 info lifecycle @pnp/[email protected]
7 verbose lifecycle @pnp/[email protected]
test: unsafe-perm in lifecycle truetest: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\PatrickLamber\Documents\GitHub\office365-cli\node_modules.bin;C:\Python27;C:\Python27\Scripts;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;C:\Program Files\Git\cmd;C:\Program Files\nodejs;C:\ProgramData\chocolatey\bin;C:\Users\PatrickLamber\AppData\Local\Microsoft\WindowsApps;C:\Users\PatrickLamber\AppData\Local\GitHubDesktop\bin;C:\Users\PatrickLamber\AppData\Local\Programs\Fiddler;C:\Users\PatrickLamber\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\PatrickLamber\AppData\Roaming\npm8 verbose lifecycle @pnp/[email protected]
9 verbose lifecycle @pnp/[email protected]
test: CWD: C:\Users\PatrickLamber\Documents\GitHub\office365-clitest: Args: [ '/d /s /c', 'nyc -r=lcov -r=text mocha "dist/**/*.spec.js"' ]10 silly lifecycle @pnp/[email protected]
11 silly lifecycle @pnp/[email protected]
test: Returned: code: 1 signal: nulltest: Failed to exec test script12 info lifecycle @pnp/[email protected]
13 verbose stack Error: @pnp/[email protected] test:
nyc -r=lcov -r=text mocha "dist/**/*.spec.js"
13 verbose stack Exit status 1
13 verbose stack at EventEmitter. (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:210:5)
13 verbose stack at ChildProcess. (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:210:5)
13 verbose stack at maybeClose (internal/child_process.js:1021:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
14 verbose pkgid @pnp/[email protected]
15 verbose cwd C:\Users\PatrickLamber\Documents\GitHub\office365-cli
16 verbose Windows_NT 10.0.18362
17 verbose argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "run" "test"
18 verbose node v12.13.0
19 verbose npm v6.12.0
20 error code ELIFECYCLE
21 error errno 1
22 error @pnp/[email protected] test:
nyc -r=lcov -r=text mocha "dist/**/*.spec.js"
22 error Exit status 1
23 error Failed at the @pnp/[email protected] test script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
I tried to figure out what might be the problem but I am not able to find the issue. By chance do you see what the problem might be in the output above?
Thank you for your feedback,
Patrick
The text was updated successfully, but these errors were encountered: