sduser1
asked on
npm install pointing to specific package.json
I have added a command in scripts section of package.json to update one of the one of the dependencies.
When i run npm install, is there a way to tell the npm install to pick up specific package.json file?
Not sure how to get the npm install to use the package.json located in a local directory.
If i do a yarn install, i see it uses the package.json that was in the local directory.
If i use npm install -g command, the install does not use package.json from the local directory.
When i run npm install, is there a way to tell the npm install to pick up specific package.json file?
Not sure how to get the npm install to use the package.json located in a local directory.
If i do a yarn install, i see it uses the package.json that was in the local directory.
If i use npm install -g command, the install does not use package.json from the local directory.
ASKER
I am running the command
npm install -g
The reason I know that it is not using package.Json in the local project folder is that I have added a custom script in the scripts section of the package.json. It did not execute
npm install -g
The reason I know that it is not using package.Json in the local project folder is that I have added a custom script in the scripts section of the package.json. It did not execute
Try without the -g option.
ASKER
Tried running the command npm install without the -g option.
it is failing due to git dependency
npm ERR! Command failed: /usr/local/bin/git checkout 0.3.2
npm ERR! error: pathspec '0.3.2' did not match any file(s) known to git
Can you help me how to fix this?
it is failing due to git dependency
npm ERR! Command failed: /usr/local/bin/git checkout 0.3.2
npm ERR! error: pathspec '0.3.2' did not match any file(s) known to git
Can you help me how to fix this?
The error is saying there is something wrong with your git command. It is seeing the 0.3.2 as part of the git path - which is causing it to fail.
Does that command work on the command line when entered manually?
Does that command work on the command line when entered manually?
ASKER
tried the command 'git checkout 0.3.2
Got the same error
Error log
6259 verbose stack Error: Command failed: git checkout 0.3.2
6259 verbose stack error: pathspec '0.3.2' did not match any file(s) known to git
6259 verbose stack
6259 verbose stack at ChildProcess.exithandler (child_process.js:281:12)
6259 verbose stack at emitTwo (events.js:126:13)
6259 verbose stack at ChildProcess.emit (events.js:214:7)
6259 verbose stack at maybeClose (internal/child_process.js :915:16)
6259 verbose stack at Socket.stream.socket.on (internal/child_process.js :336:11)
6259 verbose stack at emitOne (events.js:116:13)
6259 verbose stack at Socket.emit (events.js:211:7)
6259 verbose stack at Pipe._handle.close [as _onclose] (net.js:561:12)
6260 verbose cwd /Users/sdatla/repos/newton
6261 verbose Darwin 18.6.0
6262 verbose argv "/Users/sdatla/build_tools /node-v8.1 5.1-darwin -x64-npm-5 .6.0/bin/n ode" "/Users/sdatla/build_tools /node-v8.1 5.1-darwin -x64-npm-5 .6.0/bin/n pm" "install"
Got the same error
Error log
6259 verbose stack Error: Command failed: git checkout 0.3.2
6259 verbose stack error: pathspec '0.3.2' did not match any file(s) known to git
6259 verbose stack
6259 verbose stack at ChildProcess.exithandler (child_process.js:281:12)
6259 verbose stack at emitTwo (events.js:126:13)
6259 verbose stack at ChildProcess.emit (events.js:214:7)
6259 verbose stack at maybeClose (internal/child_process.js
6259 verbose stack at Socket.stream.socket.on (internal/child_process.js
6259 verbose stack at emitOne (events.js:116:13)
6259 verbose stack at Socket.emit (events.js:211:7)
6259 verbose stack at Pipe._handle.close [as _onclose] (net.js:561:12)
6260 verbose cwd /Users/sdatla/repos/newton
6261 verbose Darwin 18.6.0
6262 verbose argv "/Users/sdatla/build_tools
Well the obvious solution is to get your git command working first.
Once that is working put it in your package.json.
I am not a git expert but if I read this page https://git-scm.com/docs/git-checkout
It would appear that you are using the checkout command correctly.
Once that is working put it in your package.json.
I am not a git expert but if I read this page https://git-scm.com/docs/git-checkout
It would appear that you are using the checkout command correctly.
This question needs an answer!
Become an EE member today
7 DAY FREE TRIALMembers can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
When you run npm it should use the package.json in the folder that you are in.
How are you running npm - is this in a script or from the command line?