Skip to content

Can't install node based hooks (jshint, jscs, eslint, etc.) with node 5.0.0 #282

Closed

Description

@tdeo

Hi,

I came across npm not managing to install jshint pre-commit. It worked well before commit e8a870d. I ran manually the commands to generate nodeenv with python -m nodeenv --prebuilt and python -m nodeenv -n system. The latter works well but the first one (when simply running pre-commit run --all-files to generate environment) gives the following error:

Errors:
    npm ERR! Linux 3.13.0-66-generic
    npm ERR! argv "/home/tdeo/.pre-commit/repopFVtES/node_env-default/bin/node" "/home/tdeo/.pre-commit/repopFVtES/node_env-default/bin/npm" "install" "-g"
    npm ERR! node v5.0.0
    npm ERR! npm  v3.3.6
    npm ERR! path /home/tdeo/.pre-commit/repopFVtES/node_env-default/lib/node_modules/.staging/__dummy_package-8df1665f65762053e4e7ca8e2f98517f
    npm ERR! code ENOENT
    npm ERR! errno -2
    npm ERR! syscall rename

    npm ERR! enoent ENOENT: no such file or directory, rename '/home/tdeo/.pre-commit/repopFVtES/node_env-default/lib/node_modules/.staging/__dummy_package-8df1665f65762053e4e7ca8e2f98517f' -> '/home/tdeo/.pre-commit/repopFVtES/node_env-default/lib/node_modules/__dummy_package'
    npm ERR! enoent This is most likely not a problem with npm itself
    npm ERR! enoent and is related to npm not being able to find a file.
    npm ERR! enoent

    npm ERR! Please include the following file with any support request:
    npm ERR!     /home/tdeo/.pre-commit/repopFVtES/npm-debug.log

If you want, I can regenerate the error and get the full log (I made the installation with system node after).

Maybe this is related to npm/npm#10166, I found few results on Google

Also, everything goes fine when I generate nodeenv with node 4.2.1 by python -m nodeenv -v -n 4.2.1 --prebuilt

Is there any possibility to have some configuration for node version ?

Thanks

Activity

  1. asottile commented on Nov 2, 2015

    @asottile
    Member

    Hmmm, let me try and reproduce this locally -- we may need to change the approach we take for our dummy packages.

    EDIT: could you include the npm-debug.log file it mentions above? It might be difficult to grab since pre-commit'll delete that directory but maybe you can set a breakpoint right before that happens? If not, when I reproduce I should be able to grab it :)

  2. asottile commented on Nov 2, 2015

    @asottile
    Member

    Seems to reproduce for me as well:

    $ pre-commit run --all-files
    [INFO] Initializing environment for git://github.com/pre-commit/mirrors-jshint.
    [INFO] Installing environment for git://github.com/pre-commit/mirrors-jshint.
    [INFO] Once installed this environment will be reused.
    [INFO] This may take a few minutes...
    An unexpected error has occurred: CalledProcessError: Command: ['bash', '-c', ". '/home/asottile/.pre-commit/reposRZR8Q/node_env-default/bin/activate' && cd '/home/asottile/.pre-commit/reposRZR8Q/' && npm install -g"]
    Return code: 254
    Expected return code: 0
    Output: 
    
        > __dummy_package@0.0.0 preinstall /home/asottile/.pre-commit/reposRZR8Q/node_env-default/lib/node_modules/.staging/__dummy_package-0adb18984398eae8db464c8212778591
        > npm install jshint@2.6.3 -g
    
        /home/asottile/.pre-commit/reposRZR8Q/node_env-default/bin/jshint -> /home/asottile/.pre-commit/reposRZR8Q/node_env-default/lib/node_modules/jshint/bin/jshint
        /home/asottile/.pre-commit/reposRZR8Q/node_env-default/lib
        └─┬ jshint@2.6.3 
          ├─┬ cli@0.6.6 
          │ └─┬ glob@3.2.11 
          │   ├── inherits@2.0.1 
          │   └── minimatch@0.3.0 
          ├─┬ console-browserify@1.1.0 
          │ └── date-now@0.1.4 
          ├── exit@0.1.2 
          ├─┬ htmlparser2@3.8.3 
          │ ├── domelementtype@1.3.0 
          │ ├── domhandler@2.3.0 
          │ ├─┬ domutils@1.5.1 
          │ │ └─┬ dom-serializer@0.1.0 
          │ │   ├── domelementtype@1.1.3 
          │ │   └── entities@1.1.1 
          │ ├── entities@1.0.0 
          │ └─┬ readable-stream@1.1.13 
          │   ├── core-util-is@1.0.1 
          │   ├── isarray@0.0.1 
          │   └── string_decoder@0.10.31 
          ├─┬ minimatch@1.0.0 
          │ ├── lru-cache@2.7.0 
          │ └── sigmund@1.0.1 
          ├── shelljs@0.3.0 
          ├── strip-json-comments@1.0.4 
          └── underscore@1.6.0 
    
    
    Errors: 
        npm ERR! Linux 3.16.0-51-generic
        npm ERR! argv "/home/asottile/.pre-commit/reposRZR8Q/node_env-default/bin/node" "/home/asottile/.pre-commit/reposRZR8Q/node_env-default/bin/npm" "install" "-g"
        npm ERR! node v5.0.0
        npm ERR! npm  v3.3.6
        npm ERR! path /home/asottile/.pre-commit/reposRZR8Q/node_env-default/lib/node_modules/.staging/__dummy_package-0adb18984398eae8db464c8212778591
        npm ERR! code ENOENT
        npm ERR! errno -2
        npm ERR! syscall rename
    
        npm ERR! enoent ENOENT: no such file or directory, rename '/home/asottile/.pre-commit/reposRZR8Q/node_env-default/lib/node_modules/.staging/__dummy_package-0adb18984398eae8db464c8212778591' -> '/home/asottile/.pre-commit/reposRZR8Q/node_env-default/lib/node_modules/__dummy_package'
        npm ERR! enoent This is most likely not a problem with npm itself
        npm ERR! enoent and is related to npm not being able to find a file.
        npm ERR! enoent 
    
        npm ERR! Please include the following file with any support request:
        npm ERR!     /home/asottile/.pre-commit/reposRZR8Q/npm-debug.log
    
    
    Check the log at ~/.pre-commit/pre-commit.log
    
  3. asottile commented on Nov 2, 2015

    @asottile
    Member

    As a workaround you can craft a config that looks like this:

    -   repo: git://github.com/pre-commit/mirrors-jshint
        sha: e86225836aadd058036f47a6de9b0ee0440476eb
        hooks:
        -   id: jshint
            language_version: 4.2.1
    
  4. asottile commented on Nov 2, 2015

    @asottile
    Member
  5. elidupuis commented on Nov 2, 2015

    @elidupuis

    I'm running into this as well. At first I thought it was a CI issue, but after I ran pre-commit clean I'm getting the same thing locally. The workaround above seems to work great 👍.

  6. tdeo commented on Nov 3, 2015

    @tdeo
    ContributorAuthor

    It worked perfectly for me. Thanks!

  7. othiym23 commented on Nov 6, 2015

    @othiym23

    This is indeed a duplicate of npm/npm#9633 (and making sure it gets fixed 🔜).

  8. brettmcintosh commented on Nov 8, 2015

    @brettmcintosh

    Same problem when installing jscs. Workaround config:

    -   repo: git://github.com/elidupuis/mirrors-jscs
        sha: e75dbd2432de67c887670f01d65f356b1b5cfad7
        hooks:
        -   id: jscs
            language_version: 4.2.2
    
  9. elidupuis commented on Nov 8, 2015

    @elidupuis

    @brettmcintosh, this will apply to any hook that runs in Node. I went through my pre-commit config file and added language_version for Node-based hook...

  10. changed the title [-]Can't install jshint with node 5.0.0[/-] [+]Can't install node based hooks (jshint, jscs, eslint, etc.) with node 5.0.0[/+] on Nov 8, 2015
  11. asottile commented on Dec 11, 2015

    @asottile
    Member

    I'm working on a workaround in pre-commit-mirror-maker that'll use the features added in #295 #311 #316

  12. asottile commented on Dec 13, 2015

    @asottile
    Member

    With the latest version of pre-commit and the latest version of these hooks it should be fixed.

    For those of you mirroring nodejs repositories, I'd suggest (re?)generating newer versions with the latest pre-commit-mirror-maker which has a fix for this.

  13. elidupuis commented on Dec 14, 2015

    @elidupuis

    @asottile For nodejs repositories, is it enough to simply update pre-commit-mirror-maker, re-run it, and push up the new commits?

  14. asottile commented on Dec 14, 2015

    @asottile
    Member

    @elidupuis from the repo side, yes. Consumers should update pre-commit and pull the latest version of those hooks as well.

  15. elidupuis commented on Dec 14, 2015

    @elidupuis

    Cool, thanks!

  16. added a commit that references this issue on Mar 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions