We're going to say, "npm link upper," and you can see it's going to then create a three-step symbolic link. We've now created that sym link in our system, so if we go back into the user directory, we now have to basically tell it we want it to use this location. But there's a way around this, and that is to go over to the upper directory and then say, "npm link," and npm link you can see is going to create a symbolic link in user/local/lib/node modules/upper to that directory that we were just in. In fact, we really can't install it because upper hasn't been published anywhere. We're in the user directory here, so if we try and use this, we're going to get this error that says, "Cannot find module 'upper.'" That's because we haven't installed it. ![]() ![]() Our index file and user just requires upper, and then logs out, passing the string "Hello World" to it. That's located here in this upper directory, and we want to use it from this user directory. In this case, we have this module named "upper" which has the amazing functionality of taking in a string and returning the uppercase version of it. NPM provides a command called "link" which is useful for exactly that purpose. Sometimes you need to use a module before it has been published, or before you are ready to publish a new version of it.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |