search

Home  >  Q&A  >  body text

node.js - The npm5.0 version has an additional packjson-lock.json. The new dependencies cannot be installed using the npm install command. Is there any solution?

Encountered a problem and failed to reference stylus. It has been solved, but I am a little confused

The background is as follows:
npm is currently upgraded to 5.0.3
When npm install, the directory will have an additional file package-lock.json
At this time, I added # in the devDependencies of package.json. ##

"stylus": "^0.54.5",
"stylus-loader": "^3.0.1"

Then when re-running npm install in the terminal, the stylus folder does not appear in the node_modules in the project

I checked the information and said it is a pitfall of the new version
https://mp.weixin.qq.com /s?__...
The solution given is to switch back to the previous npm version...

My solution process

1. Delete package-lock.json and re-npm install. The stylus folder appears in node_modules, but an error is still reported.
2. Run sudo npm install stylus-loader directly in the terminal. stylus --save-dev results in successful compilation

If anyone has the same problem, you can try it like me, and then I would like to ask the experts if there is any good way to do this. Could it be that the dependencies I write in package.json in the future must be in the terminal itself? Specify to install it...

为情所困为情所困2745 days ago2072

reply all(2)I'll reply

  • 某草草

    某草草2017-06-21 10:15:05

    I also discovered this. I checked and found out that this is a pitfall of npm5.0. My understanding is that you can only specify the version if you want to install it. This is the answer I saw on Stack Overflow, but my foreign language skills are not good, so I can only understand part of it. Your problem is that vue.js is not very good. You can try using npm or node.js. Maybe someone will know better.

    reply
    0
  • 代言

    代言2017-06-21 10:15:05

    I haven’t read the documentation, but there is a way for now to delete the lock file and npm i and it will work

    reply
    0
  • Cancelreply