Local dependency in package.json

后端 未结 12 1290
被撕碎了的回忆
被撕碎了的回忆 2020-11-22 16:42

I want to do something like this, so npm install also installs the package.json of ../somelocallib or more importantly its dependencie

12条回答
  •  一整个雨季
    2020-11-22 17:28

    This worked for me: first, make sure the npm directories have the right user

    sudo chown -R myuser ~/.npm
    sudo chown -R myuser /usr/local/lib/node_modules
    

    Then your in your package.json link the directory

    "scripts": {
     "preinstall": "npm ln mylib ../../path/to/mylib"
    }, 
    "dependencies": {
      "mylib" : "*"
    }
    

提交回复
热议问题