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

Most upvoted comments

Updated to the latest knex, the problem is still there. Temporarily fix the problem with npm link in knex dir and npm link knex in 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 prepublish is only called when you explicitly run npm install in the actual knex directory. (eg. /myProject/node_modules/knex.)

We can get build running automatically in postinstall, 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.js file, as I have here, then we can at least dodge the ENOENT error, which is start. It may even be that postinstall is called before the bin symlink is made (haven’t determined yet).

Perhaps it would be acceptable to require users to actually navigate into the node_modules/knex dir and call npm install babel && npm run build if 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 postinstall script that first checks for the presence of /lib, then builds the project if it not yet there.

Thoughts?