-
-
Notifications
You must be signed in to change notification settings - Fork 105
"Path must be a string. Received undefined" #144
Comments
Also getting this error, it seems like npx isn't able to scan and find already installed packages.
|
I get the same error on Windows 10.
|
Dupe #148 |
npx.cmd does |
|
I have this issue... |
@laggingreflex Looks like the PR failed when run through the CI tool. |
Windows 10 node -v npm -v npx -v |
Same issue here. Windows 7 |
I'm getting this as well. Windows 10 |
Same issue here. Windows 10 64 bit |
What version will include the fix? |
@cekvenich I don't understand how #168 relates to this. Can you explain please? Are you suggesting that remapping the js file extension will fix this (I've tried remapping it to node.exe and it make no difference to this issue)? |
Happy to try to help. The reason people all over www get 'Path must be a string' in Windows is because it it not running node, it is running something else. So I found that it is not running node as expected. Normally npx does node to run your js. So now that we know what the exact problem is and we can reproduce it, it should be easier to fix. Does that help you @rich-newman ? |
I also added the following to #168 - and I don't believe it is "fixed" by that issue. The issue remains. Given that npx is now distributed with Node.JS, this is a VERY IMPORTANT thing to fix! I don't pretend to understand all of the technical details but please bear in mind that this - to users - is an npx error, not an npm error. That's because npm works just fine on Windows, npx does not. I am not trying to be negative. This is a great tool and I want to see it succeed. |
This should have been fixed with |
@zkat Both the 'recommended' LTS version of node (8.11.1) AND the 'current' version (10.0.0) seem to install npm 5.6.0 currently on Windows, and have the problem. So are you saying we just need to wait for the node team to fix this? |
@rich-newman pretty much. They'll eventually get around to upgrading the CLI, when they find the time. In the meantime, though, you can do |
|
I assume this is fixed since everyone still reporting it is on older versions of npx. Just upgrade, y'all. |
Thanks for everyone's feedback. However, I would point out that all the excellent suggestions here are workarounds - they are not a solution. My point is that npx is integrated into Node.JS installations and so that needs to work without user intervention. Applying workarounds often results in long term support issues. The reason for having an open issue in the npx repo (not just node/npm) is that some users will see this as a problem with npx and should therefore be able to see what the problem is and where the problem comes from. |
@TotallyInformation Then the answer is obvious: don't use Or if you know some one in Microsoft, tell them that the |
I wonder if it would be a good idea to have a page on the npm website with some of the info in this issue. There is a page in the getting started section for Linux users about installing npm modules globally here: https://docs.npmjs.com/getting-started/fixing-npm-permissions - although its not exactly the same as the issues in this issue, something similar for Windows might be a good idea. edit: I just noticed the page now says:
so maybe it will be updated with info from here. |
@FranklinYu - I am not using it. Frankly, I didn't even know about it until someone mentioned it on a blog post. But that doesn't help other people who come across the issue does it. If Node wasn't ready for it, that's fine - after all, I'm not paying for it. However, there needs to be clear information. I do know lots of people at different levels of Microsoft as it happens. But I'm not sure what you are asking? As far as I can see - and maybe I just don't quite get the issue - there is nothing wrong with the default paths. There is simply an issue with the way that npx is configured when it is installed - presumably from the npm installation? Isn't that all that needs fixing? @Darkle - Yes, that would be a very good idea. |
There is something wrong with the default paths. I cannot figure out a reason why user path is appended after system path to form the effective path. In any case I would like the power to override the system path, and that power is available on Linux (not familiar with macOS but I believe it should be similar). It is very useful on Linux and I sometimes write my own "shim" script for some system commands, without administrator privilege. I would say that Windows is not designed with multi-user scenarios in mind. The only thing NPX can do, is to actively find and execute NPM in user path (so bypassing Windows PATH searching mechanism), and more importantly, make Node.js ship that improved version. Otherwise the globally installed NPX will always be hidden by the one that came with Node.js. I believe NPM itself is already doing this for |
OK, I can see your issue with that. Windows does put system paths first. As I've always used Windows, I guess that is normal to me. I suspect that the reason for this is security. If you put the user folders first - which are writable by the user of course - then malware could install something with the same name as a file in the system folders. One of the benefits of using npm is that it adds the local bin folder to the start of the path so that you can run local executables. I certainly agree that this seems to be an issue that comes from the packaging with npm which itself is packaged with node.js. The actual issue has been fixed, but just needs to be known about until node.js is updated with the fix. I also agree that a test for this should be included in the node and npm packaging tests. |
FYI I am running node 8.11.4, npm 6.4.0, and npx 10.2.0 on Windows 10. I was unable to run npx error free until I did what @magnusriga did to fix the path issues. So it seems this is anything but closed. |
@TotallyInformation That is false sense of security. If a user downloaded and run malware, and the antivirus did not stop it, he is already screwed. Nothing can help. Most (if not all) ways to prevent this can be bypassed by malware. And that is not the design goal of this "system and user separation" (like preventing non-admin from modifying system path). The privilege system is designed to prevent malware from one user to harm other users on the same machine. If I share a Windows machine with my classmate, their malware won't affect me, as long as the administrator is doing the right thing. |
2 years later still get this... |
@aboutqx Read the thread, buddy. It’s already been fixed. Use Node.js 10 if you are in doubt. |
Ok,i update babel-core,and it works. |
I am still having the same issue with npx |
@uchikaprojects Read the thread, buddy. It’s already been fixed. Use Node.js 10 if you are in doubt. I should make this an auto-reply. |
@FranklinYu Thanks very much, let me check it out |
This should fix #7 which was due to npx bug zkat/npx#144.
Upgrading to Node 10 fixed the issue. Remember to |
Just in case this helps someone. I had this error and it was being caused by a typo in Grunt. There is a section where we list the themes we want Grunt to rebuild in our project and one of them was spelled wrong. So it was a silly overlook that ended up being a big headache but in the end an easy fix. A way to find it is to use the --verbose tag when running a grunt build. Hope that helps someone! |
I had the same issue, I resolved by refering the below documentation. |
the link was broken. |
... it seems that anytime I run an npx command it shows "Path must be a string. Received undefined"
The text was updated successfully, but these errors were encountered: