我在node_module下新建了database文件夹,新建了两个文件,setting.js msession.js。然后在app.js中引用了这两个文件,但是npm start启动的时候就报错了,是怎么回事?
ringa_lee2017-04-17 16:14:00
What error was reported... Please post the error and take a look.
Pay attention to the way of quoting in app.js. If it is a referenced plug-in, directly require("plug-in name
") (as for why it is enough to directly quote the plug-in name, you need to know more about package.json
), if it is a file written by yourself, you need to bring relative path + file name
when quoting插件名字
")(至于为什么直接引用插件名字就可以,还得多了解下package.json
), 如果是自己写的文件,引用的时候需要带上相对路径+文件名
的
另: node_modules
是专为外部插件准备的目录,也就是npm install
会被安装到的目录,所以自己写的文件不要放到里面去,因为所有项目的.gitignore
node_modules
is a directory specially prepared for external plug-ins, which is the directory where npm install
will be installed, so do not put files you write in it, because .gitignore
of all projects will ignore this directory, so the code you write in it cannot be submitted. 🎜