claudiajs / claudia

Deploy Node.js projects to AWS Lambda and API Gateway easily
https://claudiajs.com
MIT License
3.8k stars 274 forks source link

npm install fails on fresh clone #106

Closed boneskull closed 7 years ago

boneskull commented 7 years ago

After cloning, npm install succeeds.

npm install fails.

  1. Clone this repo.
  2. Execute npm install
  3. Observe failure:
$ npm install

> claudia@2.9.0 prepublish /Volumes/CriticalMix/claudia
> npm shrinkwrap && node src/util/doc-md.js

npm ERR! Darwin 16.4.0
npm ERR! argv "/Users/boneskull/.nvm/versions/node/v4.3.2/bin/node" "/Users/boneskull/.nvm/versions/node/v4.3.2/bin/npm" "shrinkwrap"
npm ERR! node v4.3.2
npm ERR! npm  v2.14.12

npm ERR! Problems were encountered
npm ERR! Please correct and try again.
npm ERR! extraneous: esprima@2.7.3 /Volumes/CriticalMix/claudia/node_modules/esprima
npm ERR! extraneous: strip-json-comments@1.0.4 /Volumes/CriticalMix/claudia/node_modules/strip-json-comments
npm ERR! extraneous: espree@3.3.2 /Volumes/CriticalMix/claudia/node_modules/espree
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     /Volumes/CriticalMix/claudia/npm-debug.log

npm ERR! Darwin 16.4.0
npm ERR! argv "/Users/boneskull/.nvm/versions/node/v4.3.2/bin/node" "/Users/boneskull/.nvm/versions/node/v4.3.2/bin/npm" "install"
npm ERR! node v4.3.2
npm ERR! npm  v2.14.12
npm ERR! code ELIFECYCLE
npm ERR! claudia@2.9.0 prepublish: `npm shrinkwrap && node src/util/doc-md.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the claudia@2.9.0 prepublish script 'npm shrinkwrap && node src/util/doc-md.js'.
npm ERR! This is most likely a problem with the claudia package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     npm shrinkwrap && node src/util/doc-md.js
npm ERR! You can get their info via:
npm ERR!     npm owner ls claudia
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Volumes/CriticalMix/claudia/npm-debug.log

Removing npm-shrinkwrap.json and retrying npm install seems to avoid the problem.

I'd suggest removing npm shrinkwrap from the prepublish script, and/or adopting yarn or using something like publish-please instead.

stojanovic commented 7 years ago

@gojko npm prepublish is running before the installation on npm install, and it fails because of that, some info here: https://github.com/npm/npm/issues/10074

gojko commented 7 years ago

I think I found the cause, it should work now with node 4.3.2 and npm 2.14.12 (so the same versions you're using). You may need to delete node_modules before installing again.

boneskull commented 7 years ago

If the shrinkwrap file was out of date, this is a problem yarn was created to solve. The lock file simply can't get out of sync. Just a suggestion!

gojko commented 7 years ago

I've migrated the build to NPM@4 which has a separate prepublishOnly event, so shrinkwrap is no longer triggered after install. This means that the shrinkwrap is still generated when I publish the new version, but people who just want to install will not trigger that event, even with earlier versions of NPM