node.js - npm本地安装模块后如何去运行
黄舟
黄舟 2017-04-17 15:37:00
0
3
659

在使用npm install --save-dev webpack之后,将webpack安装到当前项目,但安装完成之后,运行webpack报出command not found: webpack的错误,网上说需要在package.json文件所在的文件夹下进入node_modules/.bin文件夹下,我在这个文件夹下找到了一个webpack文件,但是依旧无法运行webpack。本地安装npm模块后如何运行呢?

黄舟
黄舟

人生最曼妙的风景,竟是内心的淡定与从容!

reply all(3)
黄舟

You have to create a new webpack.config.js file in the project root directory
One hour package meeting

小葫芦

Still not installed correctly. First CD to the folder where the project is located on the command line, and then execute npm install --save-dev webpack

阿神

I just solved it myself
When installing a package with npm, if you use global installation, that is, npm install <packageName> -g, you can run it as a command in the terminal after the installation is completed, but if it is a locally installed packagenpm install --save-dev <packageName>, it cannot be run directly like this. So how do you run a locally installed package? First enter the project directory (that is, the directory where package.json is located), and then use the following command to run:


$ node_modules/.bin/<packageName>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template