knex: npm install from master broken
Hello,
It appears that the change to remove the lib directory is causing issues when knex is installed from master using npm.
PS C:\projets\test_mssql> npm install
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! node v4.2.3
npm ERR! npm v2.14.7
npm ERR! path C:\projets\test_mssql\node_modules\knex\lib\bin\cli.js
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall chmod
npm ERR! enoent ENOENT: no such file or directory, chmod 'C:\projets\test_mssql\node_modules\knex\lib\bin\cli.js'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! Please include the following file with any support request:
npm ERR! C:\projets\test_mssql\npm-debug.log
As you can see this is from a Windows installation. I am using the version from the master repo as I need MSSQL support.
Can this commit be the cause: #1149
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 18 (14 by maintainers)
Commits related to this issue
- Fix issue tgriesser/knex#1180 — committed to maxcnunes/knex by maxcnunes 8 years ago
- Temporary fix for #1180 — committed to wolfgang42/knex by wolfgang42 8 years ago
- Removed bin attribute (see https://github.com/tgriesser/knex/issues/1180) — committed to mmorgalocabal/knex by mmorgalocabal 8 years ago
Updated to the latest knex, the problem is still there. Temporarily fix the problem with
npm linkin knex dir andnpm link knexin my local project directory.Okay, so I’ve been looking at this for over three hours and I’m going to leave this for a bit. Seems that
prepublishis only called when you explicitly runnpm installin the actualknexdirectory. (eg./myProject/node_modules/knex.)We can get
buildrunning automatically inpostinstall, but definitely don’t want this happening when installing from the npm repository, because it will require installing babel.There does not seem to be a trivial way to do this cleanly.
If we make a proxy
cli.jsfile, as I have here, then we can at least dodge theENOENTerror, which is start. It may even be thatpostinstallis called before thebinsymlink is made (haven’t determined yet).Perhaps it would be acceptable to require users to actually navigate into the
node_modules/knexdir and callnpm install babel && npm run buildif they wish to depend on a specific commit? The assumption here would be that it would just be for testing and that production should always depend on the published package?Otherwise we could add a
postinstallscript that first checks for the presence of/lib, then builds the project if it not yet there.Thoughts?