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

Can not npm test on Windows, node version 12.13.0 (LTS) #1513

Closed
soryy708 opened this issue Oct 23, 2019 · 8 comments
Closed

Can not npm test on Windows, node version 12.13.0 (LTS) #1513

soryy708 opened this issue Oct 23, 2019 · 8 comments

Comments

@soryy708
Copy link
Contributor

soryy708 commented Oct 23, 2019

I forked this repository. After cloning, I ran npm install.

I tried running npm test, but got an error. Full output:

C:\Users\soryy\Documents\Software Engineering\Personal\eslint-plugin-import>npm test

> eslint-plugin-import@2.18.2 pretest C:\Users\soryy\Documents\Software Engineering\Personal\eslint-plugin-import
> linklocal

tests\files\order-redirect
resolvers\webpack
tests\files\order-redirect-scoped
utils
resolvers\node

Linked 5 dependencies

> eslint-plugin-import@2.18.2 test C:\Users\soryy\Documents\Software Engineering\Personal\eslint-plugin-import
> npm run mocha tests/src


> eslint-plugin-import@2.18.2 mocha C:\Users\soryy\Documents\Software Engineering\Personal\eslint-plugin-import
> cross-env BABEL_ENV=test NODE_PATH=./src nyc -s mocha -R dot --recursive -t 5s "tests/src"

internal/modules/cjs/loader.js:797
    throw err;
    ^

Error: Cannot find module 'C:\Users\soryy\Documents\Software Engineering\Personal\eslint-plugin-import\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: []
}
events.js:187
      throw er; // Unhandled 'error' event
      ^

Error: spawn nyc ENOENT
    at notFoundError (C:\Users\soryy\Documents\Software Engineering\Personal\eslint-plugin-import\node_modules\cross-spawn\lib\enoent.js:11:11)
    at verifyENOENT (C:\Users\soryy\Documents\Software Engineering\Personal\eslint-plugin-import\node_modules\cross-spawn\lib\enoent.js:46:16)
    at ChildProcess.cp.emit (C:\Users\soryy\Documents\Software Engineering\Personal\eslint-plugin-import\node_modules\cross-spawn\lib\enoent.js:33:19)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
Emitted 'error' event on ChildProcess instance at:
    at ChildProcess.cp.emit (C:\Users\soryy\Documents\Software Engineering\Personal\eslint-plugin-import\node_modules\cross-spawn\lib\enoent.js:36:37)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12) {
  errno: 'ENOENT',
  code: 'ENOENT',
  syscall: 'spawn nyc'
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! eslint-plugin-import@2.18.2 mocha: `cross-env BABEL_ENV=test NODE_PATH=./src nyc -s mocha -R dot --recursive -t 5s "tests/src"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the eslint-plugin-import@2.18.2 mocha 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\soryy\AppData\Roaming\npm-cache\_logs\2019-10-23T17_39_30_176Z-debug.log
npm ERR! Test failed.  See above for more details.

npm cache log:

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   'mocha',
1 verbose cli   'tests/src'
1 verbose cli ]
2 info using npm@6.12.0
3 info using node@v12.13.0
4 verbose run-script [ 'premocha', 'mocha', 'postmocha' ]
5 info lifecycle eslint-plugin-import@2.18.2~premocha: eslint-plugin-import@2.18.2
6 info lifecycle eslint-plugin-import@2.18.2~mocha: eslint-plugin-import@2.18.2
7 verbose lifecycle eslint-plugin-import@2.18.2~mocha: unsafe-perm in lifecycle true
8 verbose lifecycle eslint-plugin-import@2.18.2~mocha: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\soryy\Documents\Software Engineering\Personal\eslint-plugin-import\node_modules\.bin;C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\soryy\Documents\Software Engineering\Personal\eslint-plugin-import\node_modules\.bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;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\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\;C:\Program Files\Microsoft SQL Server\140\Tools\Binn\;C:\Program Files\Microsoft SQL Server\140\DTS\Binn\;C:\Program Files\dotnet\;C:\Program Files (x86)\dotnet\;C:\Program Files (x86)\Microsoft SQL Server\150\DTS\Binn\;C:\Program Files\nodejs\;C:\Users\soryy\AppData\Local\Microsoft\WindowsApps;C:\Users\soryy\AppData\Local\Programs\Microsoft VS Code\bin;C:\Gradle\bin;C:\Python27;C:\Program Files\heroku\bin;C:\Program Files\Docker Toolbox;C:\Program Files\OpenSSL-Win64\bin;C:\Users\soryy\AppData\Roaming\npm
9 verbose lifecycle eslint-plugin-import@2.18.2~mocha: CWD: C:\Users\soryy\Documents\Software Engineering\Personal\eslint-plugin-import
10 silly lifecycle eslint-plugin-import@2.18.2~mocha: Args: [
10 silly lifecycle   '/d /s /c',
10 silly lifecycle   'cross-env BABEL_ENV=test NODE_PATH=./src nyc -s mocha -R dot --recursive -t 5s "tests/src"'
10 silly lifecycle ]
11 silly lifecycle eslint-plugin-import@2.18.2~mocha: Returned: code: 1  signal: null
12 info lifecycle eslint-plugin-import@2.18.2~mocha: Failed to exec mocha script
13 verbose stack Error: eslint-plugin-import@2.18.2 mocha: `cross-env BABEL_ENV=test NODE_PATH=./src nyc -s mocha -R dot --recursive -t 5s "tests/src"`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (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.<anonymous> (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 eslint-plugin-import@2.18.2
15 verbose cwd C:\Users\soryy\Documents\Software Engineering\Personal\eslint-plugin-import
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" "mocha" "tests/src"
18 verbose node v12.13.0
19 verbose npm  v6.12.0
20 error code ELIFECYCLE
21 error errno 1
22 error eslint-plugin-import@2.18.2 mocha: `cross-env BABEL_ENV=test NODE_PATH=./src nyc -s mocha -R dot --recursive -t 5s "tests/src"`
22 error Exit status 1
23 error Failed at the eslint-plugin-import@2.18.2 mocha script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
@ljharb
Copy link
Member

ljharb commented Oct 23, 2019

This is likely due to being run on windows. The project is developed primarily on Mac.

Some extra steps are required on Windows: https://github.com/benmosher/eslint-plugin-import/blob/master/appveyor.yml

@soryy708 soryy708 changed the title Can not npm test on node version 12.13.0 (LTS) Can not npm test on Windows, node version 12.13.0 (LTS) Oct 23, 2019
@soryy708
Copy link
Contributor Author

soryy708 commented Oct 23, 2019

I see. I'll run these two npm is and see if it fixes it. Will keep you updated!

Perhaps a note should be added to CONTRIBUTING.md for onboarding contributors?

@ljharb
Copy link
Member

ljharb commented Oct 23, 2019

That’d be great. If you can find a way to fix the local scripts as well so they work on windows without breaking elsewhere, that’d be even better.

@soryy708
Copy link
Contributor Author

Do you mean the ones in package.json?
If I make changes, I don't have a mac to test on. I can probably install Linux in a VM though.

@soryy708
Copy link
Contributor Author

I've run npm install in .\resolvers\webpack and .\resolvers\node. I'm still getting the same error.

Looking closely at it:

Error: Cannot find module 'C:\Users\soryy\Documents\Software Engineering\Personal\eslint-plugin-import\node'

I think it is trying to find "C:\Users\soryy\Documents\Software Engineering\Personal\eslint-plugin-import\resolvers\node" instead. \resolvers\ is missing from the path.

@saschanaz
Copy link
Contributor

@KunalKene1797
Copy link

KunalKene1797 commented Nov 26, 2019

Facing the same issue on Azure DevOps build pipeline.

##[section]Starting: npm test
==============================================================================
Task         : npm
Description  : Install and publish npm packages, or run an npm command. Supports npmjs.com and authenticated registries like Azure Artifacts.
Version      : 1.158.0
Author       : Microsoft Corporation
Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/package/npm
==============================================================================
SYSTEMVSSCONNECTION exists true
SYSTEMVSSCONNECTION exists true
[command]C:\windows\system32\cmd.exe /D /S /C ""C:\Program Files\nodejs\npm.cmd" --version"
6.12.0
[command]C:\windows\system32\cmd.exe /D /S /C ""C:\Program Files\nodejs\npm.cmd" config list"
; cli configs
metrics-registry = "https://registry.npmjs.org/"
scope = ""
user-agent = "npm/6.12.0 node/v12.13.0 win32 x64"

; environment configs
cache = "C:\\npm\\cache"
prefix = "C:\\npm\\prefix"
userconfig = "D:\\a\\1\\npm\\714.npmrc"

; builtin config undefined

; node bin location = C:\Program Files\nodejs\node.exe
; cwd = D:\a\1\s
; HOME = C:\Users\VssAdministrator
; "npm config ls -l" to show all defaults.

[command]C:\windows\system32\cmd.exe /D /S /C ""C:\Program Files\nodejs\npm.cmd" test"
internal/modules/cjs/loader.js:797

    throw err;
> jamie-bot@1.0.0 test D:\a\1\s
    ^
> nyc --reporter=lcov mocha ./test/talentFlowTest.js --require mocha-steps --timeout 30000


Error: Cannot find module 'D:\a\1\s\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: []
}
npm ERR! Test failed.  See above for more details.

@ljharb ljharb mentioned this issue Dec 8, 2019
@ljharb ljharb mentioned this issue Feb 2, 2020
@ljharb
Copy link
Member

ljharb commented Feb 17, 2020

Appveyor is passing now, thanks to #1648. I’m going to close this; but will be happy to reopen it if any windows users confirm that latest master still has this problem.

@ljharb ljharb closed this as completed Feb 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

4 participants