Aws-sam-cli: Cannot install locally on macOS with npm

Created on 27 Aug 2017  路  6Comments  路  Source: aws/aws-sam-cli

Installs fine with -g, but our team installs all of our "global" packages into our project's package.json so we all have the same version.

Here is the error when installing without -g:

fs.js:772
  return binding.rename(pathModule._makeLong(oldPath),
                 ^

Error: ENOENT: no such file or directory, rename 'bin/sam' -> '/Users/jason/code/empty-dir/node_modules/aws-sam-local/node_modules/.bin/sam'
    at Object.fs.renameSync (fs.js:772:18)
    at /Users/jason/code/empty-dir/node_modules/go-npm/bin/index.js:62:12
    at /Users/jason/code/empty-dir/node_modules/go-npm/bin/index.js:51:9
    at ChildProcess.exithandler (child_process.js:262:7)
    at emitTwo (events.js:125:13)
    at ChildProcess.emit (events.js:213:7)
    at maybeClose (internal/child_process.js:927:16)
    at Socket.stream.socket.on (internal/child_process.js:348:11)
    at emitOne (events.js:115:13)
    at Socket.emit (events.js:210:7)
go-npm typbug

Most helpful comment

All 6 comments

Yeah, I am aware of this bug. It is coming from https://github.com/sanathkr/go-npm package which takes care of downloading binaries during installation. This issue https://github.com/sanathkr/go-npm/issues/1 will take care of making it compatible with Yarn and also local installation.

Once its fixed in go-npm, sam-local will start to work.

local install works in npm 2, but not in npm 3. If you want to be unblocked and not care about node version, you can install the CLI with node version 4.x - this will work.

Awesome, thanks for the info.

FYI: We're using Node 8.4.0 and npm 5.3.0 so it seems broken there as well. Our lambda projects are transpiled down to 6.10.

Just an FYI, this also impacts installation on windows.

Closing the issue here in favor for go-npm

Was this page helpful?
0 / 5 - 0 ratings