-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
AttributeError: 'MSVSProject' object has no attribute 'items' #2058
Comments
Seems it is caused by following dependencies: chokidar 3.0 no longer causes this error but watchpack v1.6 uses an older version Decided to log it here, maybe it helps someone (while waiting for new version of the mentioned webpack dependencies) |
Well, I don't think node-gyp should fail in such way, it still looks like a bug. Thanks for the report @thdk, we will investigate this! |
@bzoz
|
#661 (comment) |
I'm running Does anyone here knows a workaround for this? |
Having the same issue. Leaving traces here for completeness. Any workarounds on this? node: 12.14.1
|
Same problem popped up in our project now when updating webpack to a newer version. Doesn't seem to help to downgrade webpack again either. Haven't found a workaround yet. :( |
It looks like this happens when you try to run code written for python3 but you're using a python2 interpreter. I got this error with react-native today. For reasons unexplained I could still run my react-native project with react-native 0.65. |
@cclauss You're right. The fact that I was using Python 2.7 and that the code looks like Python 3 does not prove that this is the reason for the error. It occurred when I was upgrading a project which uses react-native. I did some digging in the module from where the error originates. In my case it seems that upgrading to react-native 0.65 resulted in no longer pulling in the node-gyp dependency so my project did not require this. I am interested if we can reproduce the problem in a minimal way. Someone recently reported a similar trace with Windows 10 Python 2.7.15 (python -V) Visual Studio 2019 :
I could not reproduce it trivially:
|
Just above the line Also, legacy Python (Python 2) is no longer supported it should be removed wherever possible. |
It seems this method might be the issue: node-gyp/gyp/pylib/gyp/generator/msvs.py Line 1784 in ca86ef2
It is called just before
|
I can reproduce this as well. Locally, it only appears to happen when running |
Relevant issues: Neither |
So, its an issue with npm and with watchpack using outdated fsevents package. I don't think we can reasonably do anything about such things. It is the same situation when a package contains code or build scripts that do not work on Windows. The workaround is described in npm/cli#558 (comment), I think we should close this issue. |
And what to do with this problem? |
Can you please try this by setting Python 2 vs. Python 3 and let us know if one works and the other does not. |
I see the problem in line - for folder, contents in bucket.items(): |
I think this bug should be reopened because the problem is not the pyhon version. Problem is in type of objects. Class MSVSProject should support items() method. I took a look in the structure of class and didn't see what propery could be like items. A little far there is a calling _DictsToFolders() method that works with items as kind of folders. I don't know... Probably MSVSProject should contain some folders as items... But I'm sure that this bug is wrong object types. |
For what it's worth, I got this error after installing the following via an Administrative Powershell:
Specifically I saw this node-gyp error on npm install -g screeps (I used --force because it had failed previously before I separately installed node-gyp) This is with versioned Node (10.20.1 64-bit via nvm) on Windows 10:
Just thought I'd share. For what it's worth, it still seemed to succeed, and it let me install further dependency (npm package) that I really wanted, which is called screeps-server-mockup, which allowed me to run the integration test suite in the screeps-typescript-starter package. So "error" might be a strong term, since it ultimately is working. |
Add a GitHub Action to test #2058 AttributeError: 'MSVSProject' object has no attribute 'items' #2058 (comment) @djD-REK Your review please.
On Windows setting the Python Version to 2.71.18 or 3.9 did not work. Tried both. |
Python 2 died on 1/1/2020 so stick with Python 3. Please try #2272 |
I'm getting this from
#2272 does not work. My version is
I'll post my solution if I managed to find one. |
|
Fascinating that Windows processes are trying to install the macOS-only https://www.npmjs.com/package/fsevents |
OS Name: Microsoft Windows 10 Pro
OS Version: 10.0.18363 N/A Build 18363
System Type: x64-based PC
msbuild: 16.4.0.56107
webpack
Non verbose output
C:\repo>npm ci npm WARN prepare removing existing node_modules/ before installationC:\repo\node_modules\fsevents>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\....\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
Traceback (most recent call last):
File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\gyp_main.py", line 50, in
sys.exit(gyp.script_main())
File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp_init_.py", line 554, in script_main
return main(sys.argv[1:])
File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp_init_.py", line 547, in main
return gyp_main(args)
File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp_init_.py", line 532, in gyp_main
generator.GenerateOutput(flat_list, targets, data, params)
File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\generator\msvs.py", line 2034, in GenerateOutput
sln_projects, project_objects, flat=msvs_version.FlatSolution())
File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\generator\msvs.py", line 1791, in _GatherSolutionFolders
return _DictsToFolders('', root, flat)
File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\generator\msvs.py", line 1744, in _DictsToFolders
for folder, contents in bucket.items():
AttributeError: 'MSVSProject' object has no attribute 'items'
gyp ERR! configure error
gyp ERR! stack Error:
gyp
failed with exit code: 1gyp ERR! stack at ChildProcess.onCpExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:351:16)
gyp ERR! stack at ChildProcess.emit (events.js:311:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Windows_NT 10.0.18363
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd C:\repo\node_modules\fsevents
gyp ERR! node -v v12.16.1
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok
added 1110 packages in 50.021s
Verbose output (from npm or node-gyp):
Edit: While logging this I've noticed that the last line in the logs is actually "npm info ok", so the error can probably be ignored?
The text was updated successfully, but these errors were encountered: