Skip to content
This repository has been archived by the owner on Aug 17, 2019. It is now read-only.

Missing platform check for packages with default install script when binding.gyp is present #49

Open
reyronald opened this issue May 11, 2018 · 0 comments · May be fixed by #50
Open

Missing platform check for packages with default install script when binding.gyp is present #49

reyronald opened this issue May 11, 2018 · 0 comments · May be fixed by #50

Comments

@reyronald
Copy link

This is a continuation of #45, a side-effect of the provided fix for it in #46 and was introduced in cipm@1.6.2.

For the case where a default install script is used and a binding.gyp file is present in the package root, npm ci will fail with packages that target a different platform that the one currently running.

Reproduction

To reproduce on Windows, use the following package.json, run npm install to create the package-lock.json, then npm ci.

Since cipm@v1.6.2 is the current latest, this is happening right now in npm@6.0.1

package.json

grunt-ts has a dependency on fsevents which is only supported on Mac OS (darwin), so it fails on Windows

{
  "dependencies": {
    "grunt-ts": "^5.0.0-beta.4"
  }
}
`npm ci` output
$ npm ci
npm WARN prepare removing existing node_modules/ before installation

> fsevents@0.3.8 install d:\repos\z\node_modules\fsevents
> node-gyp rebuild

d:\repos\z\node_modules\fsevents>if not defined npm_config_node_gyp (node "C:\Users\rrey\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "C:\Users\rrey\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
Traceback (most recent call last):
  File "C:\Users\rrey\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\gyp\gyp_main.py", line 16, in <module>
    sys.exit(gyp.script_main())
  File "C:\Users\rrey\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 545, in script_main
    return main(sys.argv[1:])
  File "C:\Users\rrey\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 538, in main
    return gyp_main(args)
  File "C:\Users\rrey\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 523, in gyp_main
    generator.GenerateOutput(flat_list, targets, data, params)
  File "C:\Users\rrey\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\generator\msvs.py", line 2019, in GenerateOutput
    sln_projects, project_objects, flat=msvs_version.FlatSolution())
  File "C:\Users\rrey\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\generator\msvs.py", line 1778, in _GatherSolutionFolders
    return _DictsToFolders('', root, flat)
  File "C:\Users\rrey\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\generator\msvs.py", line 1731, in _DictsToFolders
    for folder, contents in bucket.iteritems():
AttributeError: 'MSVSProject' object has no attribute 'iteritems'
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (C:\Users\rrey\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\configure.js:336:16)
gyp ERR! stack     at ChildProcess.emit (events.js:127:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:12)
gyp ERR! System Windows_NT 10.0.17134
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\rrey\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd d:\repos\z\node_modules\fsevents
gyp ERR! node -v v9.7.1
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
added 77 packages in 5.201sactTree: info lifecycle fsevents@0.3.8~install: fsevents@0.3.8
reyronald added a commit to reyronald/cipm that referenced this issue May 11, 2018
This is a continuation of zkat#45, a side-effect of the provided fix for it
in zkat#46 and was introduced in `cipm@1.6.2`.

For the case where a default `install` script is used and a
`binding.gyp` file is present in  the package root, `npm ci` will fail
with packages that target a different platform that the one currently
running.

Fixes zkat#49
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant