`npm build` doesn't run the script named “build” in package.json

 Source: https://stackoverflow.com/questions/29939697/npm-build-doesnt-run-the-script-named-build-in-package-json


Unfortunately npm build is already an internal command, as described in the docs:

This is the plumbing command called by npm link and npm install. It should generally not be called directly.

Because that command already exists, it always shadows over your "build": "node build.js".

The fully-qualified way to run your own script is with run-script or its alias run:

$ npm run build

npm start and others are the short-hand way, but is only an option when an existing npm command doesn't shadow it, like npm build does.


For posterity (as others have mentioned) npm build is used by npm to build native C/C++ Node addons using node-gyp. It's not documented well because usually it happens automatically, but if you're interested the source code is here.

Không có nhận xét nào:

Cold Turkey Blocker

 https://superuser.com/questions/1366153/how-to-get-rid-of-cold-turkey-website-blocker-get-around-the-block Very old question, but still wan...