pnpm パッケージLocal installation of package suddenly stopped working

Asked 1 years ago, Updated 1 years ago, 360 views

It's been about half a year since I used npm.

The other day, the local installation of the package did not work well on npm, so
I'd like some advice to fix it.

I was developing using npm+webpack in Windows 10.
After installing additional clean webpack plugins,
Immediately after installation, npm-scripts no longer functioning with webpack.

 'webpack' is an internal or external command.
Not recognized as an operational program or batch file.

Here's what I tried to fix.

  • Return to the state before installing the clean webpack plugin (git), run npmi
  • Install webpack and other related packages globally
  • Reinstall and run npmi after removing Node.js completely
  • Node.js, npm version upgrade

I checked the local node_modules and found that there were no webpack or other related package files.
When I tried creating a new project and ran npm init-y&npmi-D webpack, the following files were generated (all contents are empty):

node_modules
- - @jridgewell
- -@types
- - @webassemblyjs
- - @xtuc
--.package-lock.json

Installing webpack globally generates webpack files within %APPDATA%\npm.

When I cloned a project on another PC and npmi, I found that
The other PCs successfully installed the package locally.

Then, when I copied node_modules generated by other PCs to the defective PC,
It now works.

However, I cannot install the package on another device every time, so
I really want to fix it.

I'm sorry for the long letter.
Thank you for your cooperation.

windows nodejs npm

2022-12-21 20:10

1 Answers

Self-Solving

For some reason local installation was successful for other users, so
Created a batch to launch a command prompt from another user with the runas command.

runas/savecred/user:<Username>>cmd

As no direct solution has been reached,
If anyone knows the cause, please advise me.


2022-12-21 23:58

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.