简体   繁体   中英

Why do i get this node.js build error?

I'm trying to build my project using browserify, (the local binary from node_modules/.bin/ )

this is the complete command

./node_modules/.bin/browserify . | uglifyjs -cm >js/bundle.min.js

my directory is /var/www/react-shopping



I do not understand this error, Error: Cannot find module '/var/www/react-shopping'

Complete error here,

Error: Cannot find module '/var/www/react-shopping' from '/var/www/react-shopping'
    at /var/www/react-shopping/node_modules/browserify/node_modules/browser-resolve/node_modules/resolve/lib/async.js:55:21
    at load (/var/www/react-shopping/node_modules/browserify/node_modules/browser-resolve/node_modules/resolve/lib/async.js:69:43)
    at onex (/var/www/react-shopping/node_modules/browserify/node_modules/browser-resolve/node_modules/resolve/lib/async.js:92:31)
    at /var/www/react-shopping/node_modules/browserify/node_modules/browser-resolve/node_modules/resolve/lib/async.js:22:47
    at FSReqWrap.oncomplete (fs.js:95:15)

try this:

browserify index.js | uglifyjs -cm > js/bundle.min.js

where index.js is the entry point of your application.

browserify should be installed with:

npm install --save-dev browserify

and uglifyjs with:

npm install --save-dev uglifyify

Take a look at this for more information

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM