Skip to content

Commit 454cede

Browse files
committed
meh
1 parent a86e469 commit 454cede

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

lib_dev/process.js

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,8 +251,23 @@ export function setup(cwd = process.cwd()) {
251251
* @param {ExecOptions} [options]
252252
* @return {Promise<ExecResult>}
253253
*/
254-
npm(args = [], options = {}) {
255-
return exec("npx", ["npm", ...args], options);
254+
async npm(args = [], options = {}) {
255+
// Use node to run npm directly since npm might not be in PATH
256+
const nodePath = process.execPath;
257+
const nodeDir = path.dirname(nodePath);
258+
const npmPath = path.join(nodeDir, 'npm');
259+
260+
try {
261+
// Try to use npm from the same directory as node
262+
await fs.access(npmPath);
263+
console.log(`Using npm from Node.js directory: ${npmPath}`);
264+
return exec(npmPath, args, options);
265+
} catch (err) {
266+
console.log(`npm not found in Node.js directory: ${err.message}`);
267+
}
268+
269+
// Fallback to direct npm execution
270+
return exec("npm", args, options);
256271
},
257272
};
258273
}

tests/rewatch_tests/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
"type": "module",
44
"packageManager": "[email protected]",
55
"dependencies": {
6-
"npm": "^10.0.0",
76
"rescript": "workspace:^"
87
},
98
"scripts": {

0 commit comments

Comments
 (0)