npm install module in current directory

后端 未结 7 1244
眼角桃花
眼角桃花 2020-12-12 21:00

When I run:

npm install my-app

The app is installed into node_modules/my-app/...

I also tried

npm install -g my-app         


        
相关标签:
7条回答
  • 2020-12-12 21:48

    Using Windows 7. I had installed nodejs in a different folder (c:\develop\nodejs) to the one that was suggested while installing (C:\Program Files\nodejs) I am totally new to nodejs or npm. i may not be talking the nodejs or npm language. After installing nodejs. I had to do some commands like this in the main nodejs folder

    npm init
    

    then I was going to create a local directory (say c:\develop\nodejs\ upload2s3), and create a nodejs package to use as AWS lambda. For this, i went into the local directory (upload2s3), and tried

    npm install aws-sdk
    

    though the command behaved like it installed things, this did not do anything in my upload2s3 folder as it was empty. then i just tried this in my local folder.

    npm init 
    

    this created some package.json, and may be few other files then i tried

    npm install aws-sdk
    

    then it created a node-modules folders inside my local folder (upload2s3) and installed the aws-sdk package. It also updated the package.json file

    {
      "name": "uploadtos32",
      "version": "1.0.0",
      "description": "",
      "main": "index.js",
      "scripts": {
        "test": "echo \"Error: no test specified\" && exit 1"
      },
      "author": "",
      "license": "ISC",
      "dependencies": {
        "aws-sdk": "^2.448.0"
      }
    }
    
    0 讨论(0)
提交回复
热议问题