-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
[BUG] npm run / start / test
cannot find module when path to directory contains ampersand &
or caret ^
.
#4225
Comments
Seeing the same behavior under v8.0.0. |
Confirmed. Same issue here in v8.5.2. |
Same here, issue still encountered in v8.13.2. Any workaround? |
Same here with NPM v9.6.3 on a Node v14.21.3 |
Same here on npm 10.2.4. STILL no workaround?? |
the workaround would be to rename your directory. |
Thought about adding "Username my organization provided for me has an ampersand in it so I can't rename the directory" but I thought it was extraneous info. |
nope, since it's extremely uncommon to have non-alphanumeric chars in a username in any part of computing, that's pretty important info to state explicitly. |
Except for when you're on a thread about special characters causing an issue. Also, workaround found: use yarn. Zero problems. |
What constitutes a valid pathname is not up for debate. Systems allow names such as |
@Voltra i wasn't debating it. I was just pointing out that a workaround does exist. |
I'll try to have a look if I can find a way to fix the paths handling (in npm or node's module resolution directly) |
It looks to me like that the issue might come from |
Is there an existing issue for this?
This issue exists in the latest npm version
Current Behavior
If script defined in package.json (
npm start
/npm test
/npm run test
) depends on something installed locally in node_modules directory (react-scripts, jest, etc.), e.g.:and ( important! ) path to current working directory contains ampersand
&
or caret^
, then npm does not see these dependencies and as a result throws the following error:In the above situation, installing jest globally also did not make the script run.
Similar bug was also incorrectly reported as Next.js problem here: vercel/next.js#26906
Expected Behavior
I expect the behavior (script runs) to be similar to the situation where the path does not contain a special character (
&
/^
), or I expect npm to inform user about incorrect path of the working directory - just like when the commandnpm init -y
is issued:log from the above command
Steps To Reproduce
npm init -y
npm install jest
npm run test
ornpm test
- both failEnvironment
The text was updated successfully, but these errors were encountered: